Trait RealmClientSender

Source
pub trait RealmClientSender {
    type Transport: Transport;

    // Required methods
    fn open_controller<___R>(
        &self,
        request: &mut ___R,
    ) -> Result<ResponseFuture<'_, Self::Transport, OpenController>, EncodeError>
       where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmOpenControllerRequest>;
    fn open_exposed_dir<___R>(
        &self,
        request: &mut ___R,
    ) -> Result<ResponseFuture<'_, Self::Transport, OpenExposedDir>, EncodeError>
       where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmOpenExposedDirRequest>;
    fn create_child<___R>(
        &self,
        request: &mut ___R,
    ) -> Result<ResponseFuture<'_, Self::Transport, CreateChild>, EncodeError>
       where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmCreateChildRequest>;
    fn destroy_child<___R>(
        &self,
        request: &mut ___R,
    ) -> Result<ResponseFuture<'_, Self::Transport, DestroyChild>, EncodeError>
       where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmDestroyChildRequest>;
    fn list_children<___R>(
        &self,
        request: &mut ___R,
    ) -> Result<ResponseFuture<'_, Self::Transport, ListChildren>, EncodeError>
       where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmListChildrenRequest>;
}
Expand description

A helper trait for the Realm client sender.

Required Associated Types§

Source

type Transport: Transport

Required Methods§

Source

fn open_controller<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, OpenController>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmOpenControllerRequest>,

Operate on a child component. See documentation for Controller.

Errors:

  • INVALID_ARGUMENTS: child is not a valid child reference.
  • INSTANCE_NOT_FOUND: child does not exist.
  • INSTANCE_DIED: This realm no longer exists.
Source

fn open_exposed_dir<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, OpenExposedDir>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmOpenExposedDirRequest>,

Opens the exposed directory of a child component instance. When this function successfully returns, exposed_dir is bound to a directory that contains the capabilities which the child exposed to its realm via ComponentDecl.exposes (specified via “expose” declarations in the component’s manifest). The child component will not start as a result of this call. Instead, starting will occur iff the parent binds to one of the capabilities contained within exposed_dir.

exposed_dir is open as long as child exists.

Errors:

  • INVALID_ARGUMENTS: child is not a valid child reference.
  • INSTANCE_NOT_FOUND: child does not exist.
  • INSTANCE_CANNOT_RESOLVE: child’s component declaration failed to resolve.
  • INSTANCE_DIED: This realm no longer exists.
Source

fn create_child<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, CreateChild>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmCreateChildRequest>,

Creates a child component instance dynamically. When this function returns successfully, the instance exists, but it may not be running.

The environment of the child instance is determined by the environment of the collection. decl must not set environment.

If decl.startup == EAGER, or collection.durability == SINGLE_RUN, [CreateChild] will start the component and return once the component is started. Otherwise, [CreateChild] will return immediately after creating the component and will not start or resolve it.

Errors:

  • INVALID_ARGUMENTS: collection is not a valid reference or child is not a valid declaration.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_ALREADY_EXISTS: decl.name already exists in collection.
  • INSTANCE_CANNOT_RESOLVE: child’s component declaration failed to resolve in a SingleRun collection.
  • NO_SPACE: Could not allocate storage for the new instance.
  • INSTANCE_DIED: This realm no longer exists.
Source

fn destroy_child<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, DestroyChild>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmDestroyChildRequest>,

Destroys a dynamically-created component instance. When this function returns, the instance is destroyed and has stopped running. However, cleanup of the component’s resources (such as its isolated storage) may happen in the background after this function returns.

Errors:

  • INVALID_ARGUMENTS: child is not a valid reference or does not refer to a dynamic instance.
  • INSTANCE_NOT_FOUND: child does not exist.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_DIED: This realm no longer exists.
Source

fn list_children<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, ListChildren>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmListChildrenRequest>,

Returns an iterator that lists all instances in a collection.

NOTE: The results are not guaranteed to be consistent. Instances may be created or destroyed while the iterator is live, but those changes won’t be observed by the iterator after this method returns.

Errors:

  • INVALID_ARGUMENTS: collection is not a valid reference or iter does not have ZX_RIGHT_WAIT.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_DIED: This realm no longer exists.
  • If iter does not have standard channel rights, this function may return ACCESS_DENIED or component manager may close iter.

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.

Implementations on Foreign Types§

Source§

impl<___T> RealmClientSender for ClientSender<___T, Realm>
where ___T: Transport,

Source§

fn open_controller<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, OpenController>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmOpenControllerRequest>,

Operate on a child component. See documentation for Controller.

Errors:

  • INVALID_ARGUMENTS: child is not a valid child reference.
  • INSTANCE_NOT_FOUND: child does not exist.
  • INSTANCE_DIED: This realm no longer exists.
Source§

fn open_exposed_dir<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, OpenExposedDir>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmOpenExposedDirRequest>,

Opens the exposed directory of a child component instance. When this function successfully returns, exposed_dir is bound to a directory that contains the capabilities which the child exposed to its realm via ComponentDecl.exposes (specified via “expose” declarations in the component’s manifest). The child component will not start as a result of this call. Instead, starting will occur iff the parent binds to one of the capabilities contained within exposed_dir.

exposed_dir is open as long as child exists.

Errors:

  • INVALID_ARGUMENTS: child is not a valid child reference.
  • INSTANCE_NOT_FOUND: child does not exist.
  • INSTANCE_CANNOT_RESOLVE: child’s component declaration failed to resolve.
  • INSTANCE_DIED: This realm no longer exists.
Source§

fn create_child<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, CreateChild>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmCreateChildRequest>,

Creates a child component instance dynamically. When this function returns successfully, the instance exists, but it may not be running.

The environment of the child instance is determined by the environment of the collection. decl must not set environment.

If decl.startup == EAGER, or collection.durability == SINGLE_RUN, [CreateChild] will start the component and return once the component is started. Otherwise, [CreateChild] will return immediately after creating the component and will not start or resolve it.

Errors:

  • INVALID_ARGUMENTS: collection is not a valid reference or child is not a valid declaration.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_ALREADY_EXISTS: decl.name already exists in collection.
  • INSTANCE_CANNOT_RESOLVE: child’s component declaration failed to resolve in a SingleRun collection.
  • NO_SPACE: Could not allocate storage for the new instance.
  • INSTANCE_DIED: This realm no longer exists.
Source§

fn destroy_child<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, DestroyChild>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmDestroyChildRequest>,

Destroys a dynamically-created component instance. When this function returns, the instance is destroyed and has stopped running. However, cleanup of the component’s resources (such as its isolated storage) may happen in the background after this function returns.

Errors:

  • INVALID_ARGUMENTS: child is not a valid reference or does not refer to a dynamic instance.
  • INSTANCE_NOT_FOUND: child does not exist.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_DIED: This realm no longer exists.
Source§

fn list_children<___R>( &self, request: &mut ___R, ) -> Result<ResponseFuture<'_, Self::Transport, ListChildren>, EncodeError>
where ___R: Encode<<Self::Transport as Transport>::SendBuffer, Encoded = WireRealmListChildrenRequest>,

Returns an iterator that lists all instances in a collection.

NOTE: The results are not guaranteed to be consistent. Instances may be created or destroyed while the iterator is live, but those changes won’t be observed by the iterator after this method returns.

Errors:

  • INVALID_ARGUMENTS: collection is not a valid reference or iter does not have ZX_RIGHT_WAIT.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_DIED: This realm no longer exists.
  • If iter does not have standard channel rights, this function may return ACCESS_DENIED or component manager may close iter.
Source§

type Transport = ___T

Implementors§