pub struct TestNetwork<'a> { /* private fields */ }
Expand description
A virtual Network.
TestNetwork
is a single virtual broadcast domain backed by Netemul.
Created through TestSandbox::create_network
.
Implementations§
Source§impl<'a> TestNetwork<'a>
impl<'a> TestNetwork<'a>
Sourcepub fn into_proxy(self) -> NetworkProxy
pub fn into_proxy(self) -> NetworkProxy
Extracts the proxy to the backing network.
Note that this defeats the lifetime semantics that ensure the sandbox in
which this network was created lives as long as the network. The caller of
TestNetwork::into_proxy
is responsible for ensuring that the sandbox
outlives the network.
Sourcepub async fn set_config(&self, config: NetworkConfig) -> Result<(), Error>
pub async fn set_config(&self, config: NetworkConfig) -> Result<(), Error>
Sets the configuration for this network to config
.
Sourcepub async fn attach_endpoint(&self, ep: &TestEndpoint<'a>) -> Result<(), Error>
pub async fn attach_endpoint(&self, ep: &TestEndpoint<'a>) -> Result<(), Error>
Attaches ep
to this network.
Sourcepub async fn create_endpoint<S>(
&self,
name: S,
) -> Result<TestEndpoint<'a>, Error>
pub async fn create_endpoint<S>( &self, name: S, ) -> Result<TestEndpoint<'a>, Error>
Creates a new endpoint with name
attached to this network.
Characters may be dropped from the front of name
if it exceeds the maximum length.
Sourcepub async fn create_endpoint_with(
&self,
name: impl Into<Cow<'a, str>>,
config: EndpointConfig,
) -> Result<TestEndpoint<'a>, Error>
pub async fn create_endpoint_with( &self, name: impl Into<Cow<'a, str>>, config: EndpointConfig, ) -> Result<TestEndpoint<'a>, Error>
Creates a new endpoint with name
and config
attached to this network.
Characters may be dropped from the front of name
if it exceeds the maximum length.
Sourcepub fn create_fake_endpoint(&self) -> Result<TestFakeEndpoint<'a>, Error>
pub fn create_fake_endpoint(&self) -> Result<TestFakeEndpoint<'a>, Error>
Returns a fake endpoint.
Sourcepub async fn start_capture(&self, name: &str) -> Result<PacketCapture, Error>
pub async fn start_capture(&self, name: &str) -> Result<PacketCapture, Error>
Starts capturing packet in this network.
The packet capture will be stored under a predefined directory:
/custom_artifacts
. More details can be found here:
https://fuchsia.dev/fuchsia-src/development/testing/components/test_runner_framework?hl=en#custom-artifacts
Sourcepub async fn stop_capture(&self) -> Result<(), Error>
pub async fn stop_capture(&self) -> Result<(), Error>
Stops packet capture in this network.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TestNetwork<'a>
impl<'a> !RefUnwindSafe for TestNetwork<'a>
impl<'a> Send for TestNetwork<'a>
impl<'a> Sync for TestNetwork<'a>
impl<'a> Unpin for TestNetwork<'a>
impl<'a> !UnwindSafe for TestNetwork<'a>
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§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