pub struct DIFInterface {
pub cache: RefCell<SharedValuesCache>,
/* private fields */
}Fields§
§cache: RefCell<SharedValuesCache>Implementations§
Source§impl DIFInterface
impl DIFInterface
pub fn new( transceiver_id: TransceiverId, address_provider: Rc<RefCell<SelfOwnedPointerAddressProvider>>, ) -> Self
Source§impl DIFInterface
impl DIFInterface
Sourcepub fn get_current_observers(
&self,
address: &PointerAddress,
source_id: &TransceiverId,
) -> Result<Vec<ObserverCallback>, ValueNotFoundInCacheError>
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
Sourcepub fn register_callable(
&self,
callable: NativeCallable,
name: Option<String>,
signature: CallableTypeDefinition,
) -> SelfOwnedPointerAddress
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.
Sourcepub fn apply_sync(
&self,
runtime: &Runtime,
callee: ValueContainer,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
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.
Sourcepub async fn apply_async(
self: Rc<Self>,
runtime: &Runtime,
callee: ValueContainer,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError>
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.
Sourcepub fn call_method_sync(
&self,
runtime: &Runtime,
callee: ValueContainer,
method: String,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ExecutionError>
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
Sourcepub async fn call_method_async(
self: Rc<Self>,
runtime: &Runtime,
callee: ValueContainer,
method: String,
args: Vec<ApplyArgument>,
) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ExecutionError>
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
Sourcepub fn create_pointer(
&self,
value: BaseSharedValueContainer,
) -> SelfOwnedPointerAddress
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.
Sourcepub fn resolve_pointer_address(
&self,
address: PointerAddress,
) -> Result<SharedContainer, ValueNotFoundInCacheError>
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.
pub fn has_address_with_ownership( &self, pointer_address: &PointerAddress, ownership: SharedContainerOwnership, ) -> bool
Sourcepub fn observe_pointer(
&self,
address: PointerAddress,
options: ObserveOptions,
callback: impl Fn(&Update) + 'static,
) -> Result<ObserverId, DIFObserveError>
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.
Sourcepub fn update_observer_options(
&self,
address: PointerAddress,
observer_id: ObserverId,
options: ObserveOptions,
) -> Result<(), DIFObserveError>
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.
Sourcepub fn unobserve_pointer(
&self,
address: PointerAddress,
observer_id: ObserverId,
) -> Result<(), DIFObserveError>
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§
impl !Freeze for DIFInterface
impl !RefUnwindSafe for DIFInterface
impl !Send for DIFInterface
impl !Sync for DIFInterface
impl !UnwindSafe for DIFInterface
impl Forget for DIFInterface
impl Move for DIFInterface
impl Unpin for DIFInterface
impl UnsafeUnpin for DIFInterface
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> 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