pub struct PhlowObject(/* private fields */);Implementations§
Source§impl PhlowObject
impl PhlowObject
pub fn object<T: Any>( object: T, phlow_extensions_fn: impl Fn(&T) -> Vec<PhlowExtension> + 'static, ) -> Self
pub fn object_with_generics<T: 'static>( object: T, phlow_extensions_fn: impl Fn(&T) -> Vec<PhlowExtension> + 'static, generic_types: Vec<PhlowType>, ) -> Self
pub fn reference<T: 'static>( object: &T, parent: &PhlowObject, phlow_extensions_fn: impl Fn(&T) -> Vec<PhlowExtension> + 'static, ) -> Self
pub fn construct_reference<T: 'static>( reference: &T, phlow_type: PhlowType, parent: Option<PhlowObject>, ) -> Self
pub fn new( value: AnyValue, phlow_type: PhlowType, generic_types: Vec<PhlowType>, parent: Option<PhlowObject>, ) -> Self
pub fn phlow_type(&self) -> &PhlowType
pub fn generic_phlow_type(&self, index: usize) -> Option<PhlowType>
pub fn generic_phlow_types(&self) -> &[PhlowType]
pub fn to_string(&self) -> String
Sourcepub fn has_value(&self) -> bool
pub fn has_value(&self) -> bool
Return true if phlow object contains a value - object or reference. Note, that even though has_value() may return true, it does not mean that the value can actually be taken, because it does not check the runtime type.
Sourcepub fn take_value<T: Any>(&self) -> Option<T>
pub fn take_value<T: Any>(&self) -> Option<T>
Take the ownership of the value leaving AnyValue::None in its place. The value can only be taken if phlow object owned it
Sourcepub fn replace_value<T: Any>(&self, object: T) -> Option<T>
pub fn replace_value<T: Any>(&self, object: T) -> Option<T>
Replace an existing value with the given object and returns the previous object if any.
Sourcepub fn clone_value<T: Any + Clone>(&self) -> Option<T>
pub fn clone_value<T: Any + Clone>(&self) -> Option<T>
Attempts to clone the value
pub fn with_value<R>(&self, op: impl FnOnce(&AnyValue) -> R) -> R
pub fn value(&self) -> RwLockReadGuard<'_, RawRwLock, AnyValue>
pub fn value_mut<T: Any>( &self, ) -> Option<MappedRwLockWriteGuard<'_, RawRwLock, T>>
pub fn value_ref<T: Any>( &self, ) -> Option<MappedRwLockReadGuard<'_, RawRwLock, T>>
pub fn value_ptr(&self) -> *const c_void
pub fn value_type_name(&self) -> &str
pub fn parent(&self) -> Option<&PhlowObject>
pub fn phlow_view_methods(&self) -> Vec<PhlowViewMethod>
pub fn phlow_view_named( &self, name: impl AsRef<str>, ) -> Option<Box<dyn PhlowView>>
pub fn phlow_views(&self) -> Vec<Box<dyn PhlowView>>
Trait Implementations§
Source§impl AsPhlowObject for &PhlowObject
impl AsPhlowObject for &PhlowObject
fn is_phlow_object(&self) -> bool
fn try_into_phlow_object(&self) -> Option<PhlowObject>
Source§impl AsPhlowObject for PhlowObject
impl AsPhlowObject for PhlowObject
fn is_phlow_object(&self) -> bool
fn try_into_phlow_object(&self) -> Option<PhlowObject>
Source§impl Clone for PhlowObject
impl Clone for PhlowObject
Source§fn clone(&self) -> PhlowObject
fn clone(&self) -> PhlowObject
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PhlowObject
impl !RefUnwindSafe for PhlowObject
impl Send for PhlowObject
impl Sync for PhlowObject
impl Unpin for PhlowObject
impl !UnwindSafe for PhlowObject
Blanket Implementations§
Source§impl<T> AsPhlowObject for T
impl<T> AsPhlowObject for T
default fn is_phlow_object(&self) -> bool
default fn try_into_phlow_object(&self) -> Option<PhlowObject>
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