pub struct NameScopeRef(pub Rc<dyn INameScope>);Expand description
A shared handle to a name scope, compared by identity so that it can be a property value.
Tuple Fields§
§0: Rc<dyn INameScope>Implementations§
Source§impl NameScopeRef
impl NameScopeRef
pub fn new(scope: impl INameScope + 'static) -> Self
Methods from Deref<Target = dyn INameScope>§
Sourcepub fn find_as<T: ObjectType>(&self, name: &str) -> Option<Ref<T>>
pub fn find_as<T: ObjectType>(&self, name: &str) -> Option<Ref<T>>
Finds a named element in the name scope and casts it to class T.
Returns None if the name is not registered; panics if the element is
of a different class.
Sourcepub fn get_as<T: ObjectType>(&self, name: &str) -> Ref<T>
pub fn get_as<T: ObjectType>(&self, name: &str) -> Ref<T>
Gets a named element from the name scope and casts it to class T.
Panics if the name is not registered or the element is of a different class.
Trait Implementations§
Source§impl Clone for NameScopeRef
impl Clone for NameScopeRef
Source§impl Deref for NameScopeRef
impl Deref for NameScopeRef
Source§type Target = dyn INameScope
type Target = dyn INameScope
The resulting type after dereferencing.
Source§fn deref(&self) -> &(dyn INameScope + 'static)
fn deref(&self) -> &(dyn INameScope + 'static)
Dereferences the value.
Source§impl From<Rc<dyn INameScope>> for NameScopeRef
impl From<Rc<dyn INameScope>> for NameScopeRef
Source§fn from(value: Rc<dyn INameScope>) -> Self
fn from(value: Rc<dyn INameScope>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for NameScopeRef
impl !Send for NameScopeRef
impl !Sync for NameScopeRef
impl !UnwindSafe for NameScopeRef
impl Freeze for NameScopeRef
impl Unpin for NameScopeRef
impl UnsafeUnpin for NameScopeRef
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more