Reference

Enum Reference 

Source
pub enum Reference {
    ValueReference(Rc<RefCell<ValueReference>>),
    TypeReference(Rc<RefCell<TypeReference>>),
}

Variants§

§

ValueReference(Rc<RefCell<ValueReference>>)

§

TypeReference(Rc<RefCell<TypeReference>>)

Implementations§

Source§

impl Reference

Source

pub fn try_set_property<'a>( &self, source_id: TransceiverId, dif_update_data_or_memory: impl Into<DIFUpdateDataOrMemory<'a>>, key: impl Into<ValueKey<'a>>, val: ValueContainer, ) -> Result<(), AccessError>

Sets a property on the value if applicable (e.g. for maps)

Source

pub fn try_replace<'a>( &self, source_id: TransceiverId, dif_update_data_or_memory: impl Into<DIFUpdateDataOrMemory<'a>>, value: impl Into<ValueContainer>, ) -> Result<(), AccessError>

Sets a value on the reference if it is mutable and the type is compatible.

Source

pub fn try_append_value<'a>( &self, source_id: TransceiverId, dif_update_data_or_memory: impl Into<DIFUpdateDataOrMemory<'a>>, value: impl Into<ValueContainer>, ) -> Result<(), AccessError>

Pushes a value to the reference if it is a list.

Source

pub fn try_delete_property<'a>( &self, source_id: TransceiverId, dif_update_data_or_memory: impl Into<DIFUpdateDataOrMemory<'a>>, key: impl Into<ValueKey<'a>>, ) -> Result<(), AccessError>

Tries to delete a property from the reference if it is a map. Notifies observers if successful.

Source

pub fn try_clear(&self, source_id: TransceiverId) -> Result<(), AccessError>

Source

pub fn try_list_splice<'a>( &self, source_id: TransceiverId, dif_update_data_or_memory: impl Into<DIFUpdateDataOrMemory<'a>>, range: Range<u32>, items: Vec<ValueContainer>, ) -> Result<(), AccessError>

Source§

impl Reference

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn unobserve_all(&self) -> Result<(), ObserverError>

Removes all observers from this reference. Returns an error if the reference is immutable.

Source

pub fn notify_observers(&self, dif: &DIFUpdate<'_>)

Notifies all observers of a change represented by the given DIFUpdate.

Source

pub fn has_observers(&self) -> bool

Check if there are any observers registered

Source§

impl Reference

Source

pub fn pointer_address(&self) -> Option<PointerAddress>

Source

pub fn set_pointer_address(&self, pointer_address: PointerAddress)

Sets the pointer address of the reference. Panics if the reference already has a pointer address.

Source

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.

Source

pub fn try_new_from_value_container( value_container: ValueContainer, allowed_type: Option<TypeDefinition>, maybe_pointer_id: Option<PointerAddress>, mutability: ReferenceMutability, ) -> Result<Self, ReferenceCreationError>

Creates a new reference from a value container

Source

pub fn new_from_type( type_value: Type, maybe_pointer_address: Option<PointerAddress>, maybe_nominal_type_declaration: Option<NominalTypeDeclaration>, ) -> Self

Source

pub fn try_mut_from( value_container: ValueContainer, ) -> Result<Self, ReferenceCreationError>

Source

pub fn collapse_reference_chain(&self) -> Reference

Collapses the reference chain to most inner reference to which this reference points.

Source

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.

Source

pub fn value_container(&self) -> ValueContainer

Source

pub fn allowed_type(&self) -> TypeDefinition

Source

pub fn actual_type(&self) -> TypeDefinition

Source

pub fn is_type(&self) -> bool

Source

pub fn mutable_reference(&self) -> Option<Rc<RefCell<ValueReference>>>

Returns a mutable reference to the ValueReference if this is a mutable ValueReference.

Source

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.

Source§

impl Reference

Getter for references

Source

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)

Source§

impl Reference

Source

pub fn ensure_pointer_address(&self, memory: &RefCell<Memory>) -> PointerAddress

Returns the PointerAddress of this reference, if it has one. Otherwise, it registers the reference in the given memory and returns the newly assigned PointerAddress.

Trait Implementations§

Source§

impl Apply for Reference

Source§

fn apply( &self, args: &[ValueContainer], ) -> Result<Option<ValueContainer>, ExecutionError>

Applies multiple ValueContainer arguments to self
Source§

fn apply_single( &self, arg: &ValueContainer, ) -> Result<Option<ValueContainer>, ExecutionError>

Applies a single ValueContainer argument to self
Source§

impl Clone for Reference

Source§

fn clone(&self) -> Reference

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 Reference

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Reference

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Into<ValueContainer>> From<T> for Reference

Source§

fn from(value_container: T) -> Self

Creates a new immutable reference from a value container.

Source§

impl From<TypeReference> for Reference

Source§

fn from(reference: TypeReference) -> Self

Converts to this type from the input type.
Source§

impl From<ValueReference> for Reference

Source§

fn from(reference: ValueReference) -> Self

Converts to this type from the input type.
Source§

impl Hash for Reference

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Identity for Reference

Two references are identical if they point to the same data

Source§

fn identical(&self, other: &Self) -> bool

Check if two values are strictly identical (same pointer, same value, same type, same permissions).
Source§

impl PartialEq for Reference

PartialEq corresponds to pointer equality / identity for Reference.

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralEq for Reference

Source§

fn structural_eq(&self, other: &Self) -> bool

Check if two values are equal, ignoring the type.
Source§

impl ValueEq for Reference

Source§

fn value_eq(&self, other: &Self) -> bool

Check if two values are exactly equal, including the type.
Source§

impl Eq for Reference

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> Any for T
where T: Any,

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,