Skip to main content

DIFInterface

Struct DIFInterface 

Source
pub struct DIFInterface {
    pub cache: RefCell<SharedValuesCache>,
    /* private fields */
}

Fields§

§cache: RefCell<SharedValuesCache>

Implementations§

Source§

impl DIFInterface

Source

pub fn new( transceiver_id: TransceiverId, address_provider: Rc<RefCell<SelfOwnedPointerAddressProvider>>, ) -> Self

Source§

impl DIFInterface

Source

pub fn get_current_observers( &self, address: &PointerAddress, source_id: &TransceiverId, ) -> Result<Vec<ObserverCallback>, ValueNotFoundInCacheError>

Returns a list of all ObserverCallbacks that are currently active for the pointer

Source

pub fn register_callable( &self, callable: NativeCallable, name: Option<String>, signature: CallableTypeDefinition, ) -> SelfOwnedPointerAddress

Registers a native callable function in the DIFInterface as a shared value and returns its pointer address.

Source

pub fn apply_sync( &self, runtime: &Runtime, callee: ValueContainer, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>

Executes an apply operation, applying the value to the callee.

Source

pub async fn apply_async( self: Rc<Self>, runtime: &Runtime, callee: ValueContainer, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>

Executes an async apply operation, applying the value to the callee.

Source

pub fn call_method_sync( &self, runtime: &Runtime, callee: ValueContainer, method: String, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ExecutionError>

Calls async method on a value

Source

pub async fn call_method_async( self: Rc<Self>, runtime: &Runtime, callee: ValueContainer, method: String, args: Vec<ApplyArgument>, ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ExecutionError>

Calls an async method on a value

Source

pub fn create_pointer( &self, value: BaseSharedValueContainer, ) -> SelfOwnedPointerAddress

Creates a new owned local pointer and stores it in memory. Returns the SelfOwnedPointerAddress of the newly created pointer.

Source

pub fn resolve_pointer_address( &self, address: PointerAddress, ) -> Result<SharedContainer, ValueNotFoundInCacheError>

Resolves a pointer address of a pointer that is currently in memory to its SharedContainer. Returns an error if the pointer is not found in memory.

Source

pub fn has_address_with_ownership( &self, pointer_address: &PointerAddress, ownership: SharedContainerOwnership, ) -> bool

Source

pub fn observe_pointer( &self, address: PointerAddress, options: ObserveOptions, callback: impl Fn(&Update) + 'static, ) -> Result<ObserverId, DIFObserveError>

Starts observing changes to the pointer at the given address. As long as the pointer is observed, it will not be garbage collected.

Source

pub fn update_observer_options( &self, address: PointerAddress, observer_id: ObserverId, options: ObserveOptions, ) -> Result<(), DIFObserveError>

Updates the options for an existing observer on the pointer at the given address. If the observer does not exist, an error is returned.

Source

pub fn unobserve_pointer( &self, address: PointerAddress, observer_id: ObserverId, ) -> Result<(), DIFObserveError>

Stops observing changes to the pointer at the given address. If no other references to the pointer exist, it may be garbage collected after this call.

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

Source§

default fn dyn_eq(&self, _other: &(dyn Any + 'static)) -> bool

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<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> TryClone for T

Source§

default fn try_clone(&self) -> Result<Value, ()>

Attempts to clone Self into a new Value.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<T, U> TypeSubset<U> for T
where U: TypeSuperset<T>,

Source§

fn is_subset_of(&self, other: &U) -> bool

Returns whether self is a subset of type