fidl_fuchsia_component_test

Enum RealmRequest

Source
pub enum RealmRequest {
Show 19 variants AddChild { name: String, url: String, options: ChildOptions, responder: RealmAddChildResponder, }, AddChildFromDecl { name: String, decl: Component, options: ChildOptions, responder: RealmAddChildFromDeclResponder, }, AddLocalChild { name: String, options: ChildOptions, responder: RealmAddLocalChildResponder, }, AddChildRealm { name: String, options: ChildOptions, child_realm: ServerEnd<RealmMarker>, responder: RealmAddChildRealmResponder, }, AddChildRealmFromRelativeUrl { name: String, relative_url: String, options: ChildOptions, child_realm: ServerEnd<RealmMarker>, responder: RealmAddChildRealmFromRelativeUrlResponder, }, AddChildRealmFromDecl { name: String, decl: Component, options: ChildOptions, child_realm: ServerEnd<RealmMarker>, responder: RealmAddChildRealmFromDeclResponder, }, GetComponentDecl { name: String, responder: RealmGetComponentDeclResponder, }, ReplaceComponentDecl { name: String, component_decl: Component, responder: RealmReplaceComponentDeclResponder, }, GetRealmDecl { responder: RealmGetRealmDeclResponder, }, ReplaceRealmDecl { component_decl: Component, responder: RealmReplaceRealmDeclResponder, }, UseNestedComponentManager { component_manager_relative_url: String, responder: RealmUseNestedComponentManagerResponder, }, AddRoute { capabilities: Vec<Capability>, from: Ref, to: Vec<Ref>, responder: RealmAddRouteResponder, }, ReadOnlyDirectory { name: String, to: Vec<Ref>, directory_contents: DirectoryContents, responder: RealmReadOnlyDirectoryResponder, }, InitMutableConfigFromPackage { name: String, responder: RealmInitMutableConfigFromPackageResponder, }, InitMutableConfigToEmpty { name: String, responder: RealmInitMutableConfigToEmptyResponder, }, AddCapability { capability: Capability, responder: RealmAddCapabilityResponder, }, AddCollection { collection: Collection, responder: RealmAddCollectionResponder, }, AddEnvironment { environment: Environment, responder: RealmAddEnvironmentResponder, }, SetConfigValue { name: String, key: String, value: ConfigValueSpec, responder: RealmSetConfigValueResponder, },
}

Variants§

§

AddChild

Adds a component to the realm.

The url can be in one of the following formats:

  • an absolute component URL (such as, “fuchsia-pkg://fuchsia.com/some-package#meta/some-component.cm”)
  • a relative path component URL to a subpackaged component (like, “some-subpackage#meta/subpackaged-component.cm”); or
  • a relative fragment-only URL (like, #meta/other-component.cm; see https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only) indicating the path to a component manifest in the pkg_dir supplied to RealmBuilderFactory::Create*().

The realm builder client typically passes a handle to its own /pkg directory, and bundles the other-component into the same package.

Of the three URL types, only component declarations added via the fragment-only URL can be modified, via GetComponentDecl/ReplaceComponentDecl because realm builder actually performs its own component resolution from the component’s manifest and files bundled in the provided pkg_dir (typically from the package shared by the realm builder client component and the components added via fragment-only URL).

Errors:

  • CHILD_ALREADY_EXISTS: this realm already contains a child with the given name.
  • INVALID_MANIFEST_EXTENSION: url does not end with .cm
  • DECL_NOT_FOUND: The test package does not contain the component declaration referenced by a fragment-only component URL.
  • DECL_READ_ERROR: Encountered an I/O error when attempting to read a component declaration referenced by a fragment-only component URL from the test package.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.

Fields

§name: String
§

AddChildFromDecl

Adds a component to this realm whose declaration is set to decl. When launched, the component will share the test package as its package directory, and may access any resources from it.

Errors:

  • CHILD_ALREADY_EXISTS: this realm already contains a child with the given name.
  • INVALID_COMPONENT_DECL: decl failed validation.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.
§

AddLocalChild

Adds a component to the realm whose implementation will be provided by the client. When this component should be started, the runner channel passed into Build will receive a start request for a component whose ProgramDecl contains the moniker from the root of the constructed realm for the child that is to be run under the program key LOCAL_COMPONENT_NAME.

Errors:

  • CHILD_ALREADY_EXISTS: this realm already contains a child with the given name.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.
§

AddChildRealm

Adds a child realm which can be built with the client end of child_realm.

Errors:

  • CHILD_ALREADY_EXISTS: this realm already contains a child with the given name.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.

Fields

§name: String
§child_realm: ServerEnd<RealmMarker>
§

AddChildRealmFromRelativeUrl

Adds a child realm which can be built with the client end of child_realm, and whose contents are initialized from relative_url. relative_url must be a fragment-only URL.

Fields

§name: String
§relative_url: String
§child_realm: ServerEnd<RealmMarker>
§

AddChildRealmFromDecl

Adds a child realm which can be built with the client end of child_realm, and whose contents are initialized from decl.

Fields

§name: String
§child_realm: ServerEnd<RealmMarker>
§

GetComponentDecl

Returns the component decl for the given component. name must refer to a component that is one of the following:

  • A component with a local implementation
  • A legacy component
  • A component added with a fragment-only URL (typically, components bundled in the same package as the realm builder client, sharing the same /pkg directory, for example, #meta/other-component.cm; see https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
  • An automatically generated realm (ex: the root)

Errors:

  • NO_SUCH_CHILD: This realm does not contain a child with the given name.
  • CHILD_DECL_NOT_VISIBLE: The component decl cannot be fetched for the referenced child, because the child was added to the realm using a modern (not legacy) absolute URL or subpackaged component’s relative path URL.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.
§

ReplaceComponentDecl

Replaces the component decl for the given component. name must refer to a component that is one of the following:

  • A component with a local implementation
  • A legacy component
  • A component added with a fragment-only URL (typically, components bundled in the same package as the realm builder client, sharing the same /pkg directory, for example, #meta/other-component.cm; see https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
  • An automatically generated realm (ex: the root)

Errors:

  • NO_SUCH_CHILD: This realm does not contain a child with the given name.
  • CHILD_ALREADY_EXISTS: The component whose decl is being replaced has had a child added to it through realm builder with the same name as an element in component_decl.children.
  • CHILD_DECL_NOT_VISIBLE: The component decl cannot be manipulated for the referenced child, because the child was added to the realm using an absolute (not relative) and modern (not legacy) URL.
  • INVALID_COMPONENT_DECL: component_decl failed validation.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.

Fields

§name: String
§component_decl: Component
§

GetRealmDecl

Returns the component decl for this realm.

Errors:

  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.
§

ReplaceRealmDecl

Replaces the component decl for this realm.

Errors:

  • INVALID_COMPONENT_DECL: component_decl failed validation.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.

Fields

§component_decl: Component
§

UseNestedComponentManager

Inform the realm builder server that this realm is using a nested component manager. It’s expected that the client library has already replaced the realm’s declaration with a passthrough component manager declaration, with the exception of the root url. This method will arrange for [Builder.Build] to install the realm’s generated url as the root url in this component manager.

Fields

§component_manager_relative_url: String
§

AddRoute

Mutates component manifests in the realm such that every component in to will have a valid capability route for each item in capabilities provided by from.

Errors:

  • NO_SUCH_SOURCE: from references a non-existent child.
  • NO_SUCH_TARGET: to references a non-existent child.
  • CAPABILITIES_EMPTY: capabilities is empty.
  • TARGETS_EMPTY: to is empty.
  • SOURCE_AND_TARGET_MATCH: from is equal to one of the elements in to.
  • INVALID_COMPONENT_DECL: The requested route caused one of the involved manifests to fail validation.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.

Fields

§capabilities: Vec<Capability>
§from: Ref
§to: Vec<Ref>
§

ReadOnlyDirectory

Offers a directory capability to a component in this realm. The directory will be read-only (i.e. have r* rights), and will have the contents described in directory_contents.

Errors:

  • NO_SUCH_TARGET: offer-to references a non-existent child.
  • BUILD_ALREADY_CALLED: The Builder.Build function has been called for this realm, and thus this Realm channel can no longer be used.

Fields

§name: String
§to: Vec<Ref>
§directory_contents: DirectoryContents
§

InitMutableConfigFromPackage

Load any packaged configuration for name before using values provided to the builder.

Allows calling SetConfigValue to override packaged configuration.

§

InitMutableConfigToEmpty

Use only values provided to the builder for name’s configuration.

Allows calling SetConfigValue to provide configuration.

§

AddCapability

Add a capability to the realm.

Fields

§capability: Capability
§

AddCollection

Adds a collection to the realm.

Fields

§collection: Collection
§

AddEnvironment

Adds an environment to the realm.

Fields

§environment: Environment
§

SetConfigValue

Sets the configuration value for a field specified by key. The component specified must have a config schema with this field. The value must conform to all constraints as defined by the schema.

This method must be called after either InitMutableConfigFromPackage or InitMutableConfigToEmpty.

Errors:

  • NO_CONFIG_SCHEMA: component does not have a config schema
  • NO_SUCH_CONFIG_FIELD: key could not be found in component’s config schema
  • CONFIG_VALUE_INVALID: value does not meet config schema constraints

Implementations§

Source§

impl RealmRequest

Source

pub fn into_add_child( self, ) -> Option<(String, String, ChildOptions, RealmAddChildResponder)>

Source

pub fn into_add_child_from_decl( self, ) -> Option<(String, Component, ChildOptions, RealmAddChildFromDeclResponder)>

Source

pub fn into_add_local_child( self, ) -> Option<(String, ChildOptions, RealmAddLocalChildResponder)>

Source

pub fn into_add_child_realm( self, ) -> Option<(String, ChildOptions, ServerEnd<RealmMarker>, RealmAddChildRealmResponder)>

Source

pub fn into_add_child_realm_from_relative_url( self, ) -> Option<(String, String, ChildOptions, ServerEnd<RealmMarker>, RealmAddChildRealmFromRelativeUrlResponder)>

Source

pub fn into_add_child_realm_from_decl( self, ) -> Option<(String, Component, ChildOptions, ServerEnd<RealmMarker>, RealmAddChildRealmFromDeclResponder)>

Source

pub fn into_get_component_decl( self, ) -> Option<(String, RealmGetComponentDeclResponder)>

Source

pub fn into_replace_component_decl( self, ) -> Option<(String, Component, RealmReplaceComponentDeclResponder)>

Source

pub fn into_get_realm_decl(self) -> Option<RealmGetRealmDeclResponder>

Source

pub fn into_replace_realm_decl( self, ) -> Option<(Component, RealmReplaceRealmDeclResponder)>

Source

pub fn into_use_nested_component_manager( self, ) -> Option<(String, RealmUseNestedComponentManagerResponder)>

Source

pub fn into_add_route( self, ) -> Option<(Vec<Capability>, Ref, Vec<Ref>, RealmAddRouteResponder)>

Source

pub fn into_read_only_directory( self, ) -> Option<(String, Vec<Ref>, DirectoryContents, RealmReadOnlyDirectoryResponder)>

Source

pub fn into_init_mutable_config_from_package( self, ) -> Option<(String, RealmInitMutableConfigFromPackageResponder)>

Source

pub fn into_init_mutable_config_to_empty( self, ) -> Option<(String, RealmInitMutableConfigToEmptyResponder)>

Source

pub fn into_add_capability( self, ) -> Option<(Capability, RealmAddCapabilityResponder)>

Source

pub fn into_add_collection( self, ) -> Option<(Collection, RealmAddCollectionResponder)>

Source

pub fn into_add_environment( self, ) -> Option<(Environment, RealmAddEnvironmentResponder)>

Source

pub fn into_set_config_value( self, ) -> Option<(String, String, ConfigValueSpec, RealmSetConfigValueResponder)>

Source

pub fn method_name(&self) -> &'static str

Name of the method defined in FIDL

Trait Implementations§

Source§

impl Debug for RealmRequest

Source§

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

Formats the value using the given formatter. Read more

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
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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