pub struct Emulator { /* private fields */ }Expand description
Handle to a running emulator instance
This can represent an emulator we spawned with an EmulatorConfig, or an
already-running emulator we discovered with list_emulators.
Implementations§
Source§impl Emulator
impl Emulator
pub fn discovery_path(&self) -> &Path
Sourcepub fn metadata(&self) -> &HashMap<String, String>
pub fn metadata(&self) -> &HashMap<String, String>
Get a reference to all emulator metadata from the runtime .ini file
Sourcepub fn get_metadata(&self, key: &str) -> Option<&str>
pub fn get_metadata(&self, key: &str) -> Option<&str>
Get a specific metadata property value
Sourcepub fn requires_jwt_auth(&self) -> bool
pub fn requires_jwt_auth(&self) -> bool
Check if this emulator requires JWT authentication
Sourcepub fn emulator_version(&self) -> Option<&str>
pub fn emulator_version(&self) -> Option<&str>
Get the emulator version
Sourcepub fn emulator_build(&self) -> Option<&str>
pub fn emulator_build(&self) -> Option<&str>
Get the emulator build ID
Sourcepub fn port_serial(&self) -> Option<u16>
pub fn port_serial(&self) -> Option<u16>
Get the serial port number
Sourcepub fn grpc_endpoint(&self) -> String
pub fn grpc_endpoint(&self) -> String
Get the gRPC endpoint URL for this emulator
Sourcepub async fn connect(
&self,
timeout: Option<Duration>,
allow_basic_auth: bool,
) -> Result<EmulatorClient>
pub async fn connect( &self, timeout: Option<Duration>, allow_basic_auth: bool, ) -> Result<EmulatorClient>
Connect to the emulator’s gRPC controller
This method will automatically retry the connection if it fails, waiting up to the specified timeout duration. At least one connection attempt is always made before checking the timeout.
§Arguments
timeout- Maximum time to wait for the connection. IfNone, will wait indefinitely.allow_basic_auth- Iftrue, will use basic auth (grpc.token / console token) if available.
§Errors
Returns an error if JWT authentication setup fails.
Sourcepub async fn terminate(&self) -> Result<()>
pub async fn terminate(&self) -> Result<()>
Terminate the emulator process and wait for it to fully exit
If this instance owns the process (spawned via spawn()), this will kill the process
and wait for it to exit.
If this instance was discovered via find(), this returns an error as we don’t own
the process.
To terminate a discovered emulator, use ADB commands directly.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Emulator
impl !RefUnwindSafe for Emulator
impl Send for Emulator
impl Sync for Emulator
impl Unpin for Emulator
impl !UnwindSafe for Emulator
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request