pub struct ScopedInstanceFactory { /* private fields */ }
Expand description
Manages the creation of new components within a collection.
Implementations§
Source§impl ScopedInstanceFactory
impl ScopedInstanceFactory
Sourcepub fn new(collection_name: impl Into<String>) -> Self
pub fn new(collection_name: impl Into<String>) -> Self
Creates a new factory that creates components in the specified collection.
Sourcepub fn with_realm_proxy(self, realm_proxy: RealmProxy) -> Self
pub fn with_realm_proxy(self, realm_proxy: RealmProxy) -> Self
Use realm_proxy
instead of the fuchsia.component.Realm protocol in this component’s
incoming namespace. This can be used to start component’s in a collection belonging
to another component.
Sourcepub async fn new_instance(
&self,
url: impl Into<String>,
) -> Result<ScopedInstance, Error>
pub async fn new_instance( &self, url: impl Into<String>, ) -> Result<ScopedInstance, Error>
Creates and binds to a new component just like new_named_instance
, but uses an
autogenerated name for the instance.
Sourcepub async fn new_named_instance(
&self,
child_name: impl Into<String>,
url: impl Into<String>,
) -> Result<ScopedInstance, Error>
pub async fn new_named_instance( &self, child_name: impl Into<String>, url: impl Into<String>, ) -> Result<ScopedInstance, Error>
Creates and binds to a new component named child_name
with url
.
A ScopedInstance is returned on success, representing the component’s lifetime and
providing access to the component’s exposed capabilities.
When the ScopedInstance is dropped, the component will be asynchronously stopped and destroyed.
This is useful for tests that wish to create components that should be torn down at the end of the test, or to explicitly control the lifecycle of a component.
Auto Trait Implementations§
impl Freeze for ScopedInstanceFactory
impl !RefUnwindSafe for ScopedInstanceFactory
impl Send for ScopedInstanceFactory
impl Sync for ScopedInstanceFactory
impl Unpin for ScopedInstanceFactory
impl !UnwindSafe for ScopedInstanceFactory
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, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> IntoAny for T
impl<T> IntoAny for 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