DIFInterface

Trait DIFInterface 

Source
pub trait DIFInterface {
    // Required methods
    fn update(
        &self,
        source_id: TransceiverId,
        address: PointerAddress,
        update: DIFUpdateData,
    ) -> Result<(), DIFUpdateError>;
    fn apply(
        &self,
        callee: DIFValueContainer,
        value: DIFValueContainer,
    ) -> Result<DIFValueContainer, DIFApplyError>;
    fn create_pointer(
        &self,
        value: DIFValueContainer,
        allowed_type: Option<DIFTypeContainer>,
        mutability: ReferenceMutability,
    ) -> Result<PointerAddress, DIFCreatePointerError>;
    fn resolve_pointer_address_external(
        &self,
        address: PointerAddress,
    ) -> impl Future<Output = Result<DIFReference, DIFResolveReferenceError>>;
    fn resolve_pointer_address_in_memory(
        &self,
        address: PointerAddress,
    ) -> Result<DIFReference, DIFResolveReferenceError>;
    fn observe_pointer<F: Fn(&DIFUpdate) + 'static>(
        &self,
        transceiver_id: TransceiverId,
        address: PointerAddress,
        options: ObserveOptions,
        observer: F,
    ) -> Result<u32, DIFObserveError>;
    fn update_observer_options(
        &self,
        address: PointerAddress,
        observer_id: u32,
        options: ObserveOptions,
    ) -> Result<(), DIFObserveError>;
    fn unobserve_pointer(
        &self,
        address: PointerAddress,
        observer_id: u32,
    ) -> Result<(), DIFObserveError>;
}

Required Methods§

Source

fn update( &self, source_id: TransceiverId, address: PointerAddress, update: DIFUpdateData, ) -> Result<(), DIFUpdateError>

Applies a DIF update to the value at the given pointer address.

Source

fn apply( &self, callee: DIFValueContainer, value: DIFValueContainer, ) -> Result<DIFValueContainer, DIFApplyError>

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

Source

fn create_pointer( &self, value: DIFValueContainer, allowed_type: Option<DIFTypeContainer>, mutability: ReferenceMutability, ) -> Result<PointerAddress, DIFCreatePointerError>

Creates a new pointer and stores it in memory. Returns the address of the newly created pointer.

Source

fn resolve_pointer_address_external( &self, address: PointerAddress, ) -> impl Future<Output = Result<DIFReference, DIFResolveReferenceError>>

Resolves a pointer address of a pointer that may not be in memory. If the pointer is not in memory, it will be loaded from external storage.

Source

fn resolve_pointer_address_in_memory( &self, address: PointerAddress, ) -> Result<DIFReference, DIFResolveReferenceError>

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

Source

fn observe_pointer<F: Fn(&DIFUpdate) + 'static>( &self, transceiver_id: TransceiverId, address: PointerAddress, options: ObserveOptions, observer: F, ) -> Result<u32, 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

fn update_observer_options( &self, address: PointerAddress, observer_id: u32, 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

fn unobserve_pointer( &self, address: PointerAddress, observer_id: u32, ) -> 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§