PhlowObject

Struct PhlowObject 

Source
pub struct PhlowObject(/* private fields */);

Implementations§

Source§

impl PhlowObject

Source

pub fn object<T: Any>( object: T, phlow_extensions_fn: impl Fn(&T) -> Vec<PhlowExtension> + 'static, ) -> Self

Source

pub fn object_with_generics<T: 'static>( object: T, phlow_extensions_fn: impl Fn(&T) -> Vec<PhlowExtension> + 'static, generic_types: Vec<PhlowType>, ) -> Self

Source

pub fn reference<T: 'static>( object: &T, parent: &PhlowObject, phlow_extensions_fn: impl Fn(&T) -> Vec<PhlowExtension> + 'static, ) -> Self

Source

pub fn construct_reference<T: 'static>( reference: &T, phlow_type: PhlowType, parent: Option<PhlowObject>, ) -> Self

Source

pub fn new( value: AnyValue, phlow_type: PhlowType, generic_types: Vec<PhlowType>, parent: Option<PhlowObject>, ) -> Self

Source

pub fn phlow_type(&self) -> &PhlowType

Source

pub fn generic_phlow_type(&self, index: usize) -> Option<PhlowType>

Source

pub fn generic_phlow_types(&self) -> &[PhlowType]

Source

pub fn to_string(&self) -> String

Source

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.

Source

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

Source

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.

Source

pub fn clone_value<T: Any + Clone>(&self) -> Option<T>

Attempts to clone the value

Source

pub fn with_value<R>(&self, op: impl FnOnce(&AnyValue) -> R) -> R

Source

pub fn value(&self) -> RwLockReadGuard<'_, RawRwLock, AnyValue>

Source

pub fn value_mut<T: Any>( &self, ) -> Option<MappedRwLockWriteGuard<'_, RawRwLock, T>>

Source

pub fn value_ref<T: Any>( &self, ) -> Option<MappedRwLockReadGuard<'_, RawRwLock, T>>

Source

pub fn value_ptr(&self) -> *const c_void

Source

pub fn value_type_name(&self) -> &str

Source

pub fn parent(&self) -> Option<&PhlowObject>

Source

pub fn phlow_view_methods(&self) -> Vec<PhlowViewMethod>

Source

pub fn phlow_view_named( &self, name: impl AsRef<str>, ) -> Option<Box<dyn PhlowView>>

Source

pub fn phlow_views(&self) -> Vec<Box<dyn PhlowView>>

Trait Implementations§

Source§

impl AsPhlowObject for &PhlowObject

Source§

impl AsPhlowObject for PhlowObject

Source§

impl Clone for PhlowObject

Source§

fn clone(&self) -> PhlowObject

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PhlowObject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsPhlowObject for T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Category, T> Phlow<Category> for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.