INameScope
trait · ferroui-base · v0.5.0
trait INameScope
Defines a name scope.
Members
try_register_valueregister_valuefind_valuefind_value_asyncregistertry_registerfind_asyncfindcompleteis_completedattached_todetached_from
try_register_value
fn try_register_value(self: &Self, name: &str, value: BoxedValue) -> Result<(), NameScopeValueError>
Registers any non-null object, retaining its identity. The value form
corresponds to the managed object parameter. Existing native-only
custom scopes can override this method to accept plain objects too.
register_value
fn register_value(self: &Self, name: &str, value: BoxedValue)
Registers any object; panics on the same errors as try_register_value.
find_value
fn find_value(self: &Self, name: &str) -> Option<BoxedValue>
Finds any named object immediately, without traversing incomplete scopes.
find_value_async
fn find_value_async(self: &Self, name: &str) -> SynchronousCompletionAsyncResult<Option<BoxedValue>>
Finds any named object, completing synchronously on registration or completion.
register
fn register(self: &Self, name: &str, element: Ref<FerroObject>)
Registers an element in the name scope. Panics if the scope is
completed or another element is registered with the name: see
try_register for the form that reports these
as errors.
try_register
fn try_register(self: &Self, name: &str, element: Ref<FerroObject>) -> Result<(), NameScopeError>
Registers an element in the name scope, reporting a completed scope and a name that another element is registered with as errors. Registering an element again with its name does nothing.
find_async
fn find_async(self: &Self, name: &str) -> SynchronousCompletionAsyncResult<Option<Ref<FerroObject>>>
Finds a named element in the name scope, waits for the scope to be
completely populated before returning None. Returned results always
complete synchronously.
find
fn find(self: &Self, name: &str) -> Option<Ref<FerroObject>>
Finds a named element in the name scope, returns immediately, doesn't traverse the name scope stack.
complete
fn complete(self: &Self)
Marks the name scope as completed, no further registrations will be allowed.
is_completed
fn is_completed(self: &Self) -> bool
Whether the name scope is completed, no further registrations are allowed.
attached_to
fn attached_to(self: &Self, _owner: &Ref<FerroObject>)
The scope became the value of the attached NameScope property of
owner, which holds it from now on. Not a member of the managed
original: there the scope and the element hold each other and the
collector frees both; here the scope holds this one element weakly
(it finds it as long as it is alive). A scope that holds no elements
itself has nothing to do.
detached_from
fn detached_from(self: &Self, _owner: &Ref<FerroObject>)
The scope is no longer the value of the attached NameScope
property of owner: it holds the element as every other again.
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.