pub enum SharedContainer {
Value(Rc<RefCell<SharedValueContainer>>),
Type(Rc<RefCell<SharedTypeContainer>>),
}Variants§
Value(Rc<RefCell<SharedValueContainer>>)
Type(Rc<RefCell<SharedTypeContainer>>)
Implementations§
Sourcepub fn try_set_property<'a>(
&self,
source_id: TransceiverId,
maybe_dif_update_data: Option<&DIFUpdateData>,
key: impl Into<ValueKey<'a>>,
val: ValueContainer,
) -> Result<(), AccessError>
pub fn try_set_property<'a>( &self, source_id: TransceiverId, maybe_dif_update_data: Option<&DIFUpdateData>, key: impl Into<ValueKey<'a>>, val: ValueContainer, ) -> Result<(), AccessError>
Sets a property on the value if applicable (e.g. for maps)
Sourcepub fn try_replace(
&self,
source_id: TransceiverId,
maybe_dif_update_data: Option<&DIFUpdateData>,
value: impl Into<ValueContainer>,
) -> Result<(), AccessError>
pub fn try_replace( &self, source_id: TransceiverId, maybe_dif_update_data: Option<&DIFUpdateData>, value: impl Into<ValueContainer>, ) -> Result<(), AccessError>
Sets a value on the reference if it is mutable and the type is compatible.
Sourcepub fn try_append_value<'a>(
&self,
source_id: TransceiverId,
maybe_dif_update_data: Option<&DIFUpdateData>,
value: impl Into<ValueContainer>,
) -> Result<(), AccessError>
pub fn try_append_value<'a>( &self, source_id: TransceiverId, maybe_dif_update_data: Option<&DIFUpdateData>, value: impl Into<ValueContainer>, ) -> Result<(), AccessError>
Pushes a value to the reference if it is a list.
Sourcepub fn try_delete_property<'a>(
&self,
source_id: TransceiverId,
maybe_dif_update_data: Option<&DIFUpdateData>,
key: impl Into<ValueKey<'a>>,
) -> Result<(), AccessError>
pub fn try_delete_property<'a>( &self, source_id: TransceiverId, maybe_dif_update_data: Option<&DIFUpdateData>, key: impl Into<ValueKey<'a>>, ) -> Result<(), AccessError>
Tries to delete a property from the reference if it is a map. Notifies observers if successful.
pub fn try_clear(&self, source_id: TransceiverId) -> Result<(), AccessError>
pub fn try_list_splice<'a>( &self, source_id: TransceiverId, maybe_dif_update_data: Option<&DIFUpdateData>, range: Range<u32>, items: Vec<ValueContainer>, ) -> Result<(), AccessError>
Sourcepub fn observe(&self, observer: Observer) -> Result<u32, ObserverError>
pub fn observe(&self, observer: Observer) -> Result<u32, ObserverError>
Adds an observer to this reference that will be notified on value changes. Returns an error if the reference is immutable or a type reference. The returned u32 is an observer ID that can be used to remove the observer later.
Sourcepub fn unobserve(&self, observer_id: u32) -> Result<(), ObserverError>
pub fn unobserve(&self, observer_id: u32) -> Result<(), ObserverError>
Removes an observer by its ID. Returns an error if the observer ID is not found or the reference is immutable.
Sourcepub fn update_observer_options(
&self,
observer_id: u32,
options: ObserveOptions,
) -> Result<(), ObserverError>
pub fn update_observer_options( &self, observer_id: u32, options: ObserveOptions, ) -> Result<(), ObserverError>
Updates the options for an existing observer by its ID. Returns an error if the observer ID is not found or the reference is immutable.
Sourcepub fn observers_ids(&self) -> Vec<u32>
pub fn observers_ids(&self) -> Vec<u32>
Returns a list of all observer IDs currently registered to this reference. A type reference or immutable reference will always return an empty list.
Sourcepub fn unobserve_all(&self) -> Result<(), ObserverError>
pub fn unobserve_all(&self) -> Result<(), ObserverError>
Removes all observers from this reference. Returns an error if the reference is immutable.
Sourcepub fn notify_observers(&self, dif: &DIFUpdate<'_>)
pub fn notify_observers(&self, dif: &DIFUpdate<'_>)
Notifies all observers of a change represented by the given DIFUpdate.
Sourcepub fn has_observers(&self) -> bool
pub fn has_observers(&self) -> bool
Check if there are any observers registered
pub fn pointer_address(&self) -> PointerAddress
pub fn pointer(&self) -> Ref<'_, Pointer>
Sourcepub fn is_mutable(&self) -> bool
pub fn is_mutable(&self) -> bool
Checks if the reference is mutable. A reference is mutable if it is a mutable ValueReference and all references in the chain are mutable. TypeReferences are always immutable. FIXME #284: Do we really need this? Probably we already collapse the ref and then change it’s value and perform the mutability check on the most inner ref.
Sourcepub fn try_boxed(
value_container: ValueContainer,
allowed_type: Option<TypeDefinition>,
pointer: Pointer,
mutability: SharedContainerMutability,
) -> Result<Self, SharedValueCreationError>
pub fn try_boxed( value_container: ValueContainer, allowed_type: Option<TypeDefinition>, pointer: Pointer, mutability: SharedContainerMutability, ) -> Result<Self, SharedValueCreationError>
Creates a new shared value containing the given value container
pub fn new_from_type( type_value: Type, pointer: Pointer, maybe_nominal_type_declaration: Option<NominalTypeDeclaration>, ) -> Self
pub fn boxed_mut( value_container: ValueContainer, pointer: Pointer, ) -> Result<Self, SharedValueCreationError>
pub fn boxed( value_container: impl Into<ValueContainer>, pointer: Pointer, ) -> Self
Sourcepub fn collapse_reference_chain(&self) -> SharedContainer
pub fn collapse_reference_chain(&self) -> SharedContainer
Collapses the reference chain to most inner reference to which this reference points.
Sourcepub fn collapse_to_value(&self) -> Rc<RefCell<Value>>
pub fn collapse_to_value(&self) -> Rc<RefCell<Value>>
Converts a reference to its current value, collapsing any reference chains and converting type references to type values.
pub fn value_container(&self) -> ValueContainer
pub fn allowed_type(&self) -> TypeDefinition
pub fn actual_type(&self) -> TypeDefinition
pub fn is_type(&self) -> bool
Sourcepub fn mutable_reference(&self) -> Option<Rc<RefCell<SharedValueContainer>>>
pub fn mutable_reference(&self) -> Option<Rc<RefCell<SharedValueContainer>>>
Returns a mutable reference to the ValueReference if this is a mutable ValueReference.
Sourcepub fn set_value_container(
&self,
new_value_container: ValueContainer,
) -> Result<(), AssignmentError>
pub fn set_value_container( &self, new_value_container: ValueContainer, ) -> Result<(), AssignmentError>
Sets the value container of the reference if it is mutable. If the reference is immutable, an error is returned.
Sourcepub fn try_get_property<'a>(
&self,
key: impl Into<ValueKey<'a>>,
) -> Result<ValueContainer, AccessError>
pub fn try_get_property<'a>( &self, key: impl Into<ValueKey<'a>>, ) -> Result<ValueContainer, AccessError>
Gets a property on the value if applicable (e.g. for map and structs)
Trait Implementations§
Source§fn apply(
&self,
args: &[ValueContainer],
) -> Result<Option<ValueContainer>, ExecutionError>
fn apply( &self, args: &[ValueContainer], ) -> Result<Option<ValueContainer>, ExecutionError>
Source§fn apply_single(
&self,
arg: &ValueContainer,
) -> Result<Option<ValueContainer>, ExecutionError>
fn apply_single( &self, arg: &ValueContainer, ) -> Result<Option<ValueContainer>, ExecutionError>
Source§fn clone(&self) -> SharedContainer
fn clone(&self) -> SharedContainer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§fn from(reference: SharedTypeContainer) -> Self
fn from(reference: SharedTypeContainer) -> Self
Source§fn from(reference: SharedValueContainer) -> Self
fn from(reference: SharedValueContainer) -> Self
Source§fn structural_eq(&self, other: &Self) -> bool
fn structural_eq(&self, other: &Self) -> bool
Auto Trait Implementations§
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more