Struct phlow::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 copy 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 Twhere 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 Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.