Struct mockable::MockEnv

source ·
pub struct MockEnv { /* private fields */ }
Expand description

mockall implementation of Env.

This is supported on feature=mock only.

Example.

Implementations§

source§

impl MockEnv

source

pub fn checkpoint(&mut self)

Validate that all current expectations for all methods have been satisfied, and discard them.

source

pub fn new() -> Self

Create a new mock object with no expectations.

This method will not be generated if the real struct already has a new method. However, it will be generated if the struct implements a trait with a new method. The trait’s new method can still be called like <MockX as TraitY>::new

source§

impl MockEnv

source

pub fn expect_all(&mut self) -> &mut Expectation

Create an Expectation for mocking the all method

source

pub fn expect_bool(&mut self) -> &mut Expectation

Create an Expectation for mocking the bool method

source

pub fn expect_char(&mut self) -> &mut Expectation

Create an Expectation for mocking the char method

source

pub fn expect_f32(&mut self) -> &mut Expectation

Create an Expectation for mocking the f32 method

source

pub fn expect_f64(&mut self) -> &mut Expectation

Create an Expectation for mocking the f64 method

source

pub fn expect_i8(&mut self) -> &mut Expectation

Create an Expectation for mocking the i8 method

source

pub fn expect_i16(&mut self) -> &mut Expectation

Create an Expectation for mocking the i16 method

source

pub fn expect_i32(&mut self) -> &mut Expectation

Create an Expectation for mocking the i32 method

source

pub fn expect_i64(&mut self) -> &mut Expectation

Create an Expectation for mocking the i64 method

source

pub fn expect_i128(&mut self) -> &mut Expectation

Create an Expectation for mocking the i128 method

source

pub fn expect_ip_addr(&mut self) -> &mut Expectation

Create an Expectation for mocking the ip_addr method

source

pub fn expect_ipv4_addr(&mut self) -> &mut Expectation

Create an Expectation for mocking the ipv4_addr method

source

pub fn expect_ipv6_addr(&mut self) -> &mut Expectation

Create an Expectation for mocking the ipv6_addr method

source

pub fn expect_isize(&mut self) -> &mut Expectation

Create an Expectation for mocking the isize method

source

pub fn expect_non_zero_i8(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_i8 method

source

pub fn expect_non_zero_i16(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_i16 method

source

pub fn expect_non_zero_i32(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_i32 method

source

pub fn expect_non_zero_i64(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_i64 method

source

pub fn expect_non_zero_i128(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_i128 method

source

pub fn expect_non_zero_isize(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_isize method

source

pub fn expect_non_zero_u8(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_u8 method

source

pub fn expect_non_zero_u16(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_u16 method

source

pub fn expect_non_zero_u32(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_u32 method

source

pub fn expect_non_zero_u64(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_u64 method

source

pub fn expect_non_zero_u128(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_u128 method

source

pub fn expect_non_zero_usize(&mut self) -> &mut Expectation

Create an Expectation for mocking the non_zero_usize method

source

pub fn expect_os_string(&mut self) -> &mut Expectation

Create an Expectation for mocking the os_string method

source

pub fn expect_path_buf(&mut self) -> &mut Expectation

Create an Expectation for mocking the path_buf method

source

pub fn expect_raw(&mut self) -> &mut Expectation

Create an Expectation for mocking the raw method

source

pub fn expect_socket_addr(&mut self) -> &mut Expectation

Create an Expectation for mocking the socket_addr method

source

pub fn expect_socket_addr_v4(&mut self) -> &mut Expectation

Create an Expectation for mocking the socket_addr_v4 method

source

pub fn expect_socket_addr_v6(&mut self) -> &mut Expectation

Create an Expectation for mocking the socket_addr_v6 method

source

pub fn expect_string(&mut self) -> &mut Expectation

Create an Expectation for mocking the string method

source

pub fn expect_strings(&mut self) -> &mut Expectation

Create an Expectation for mocking the strings method

source

pub fn expect_u8(&mut self) -> &mut Expectation

Create an Expectation for mocking the u8 method

source

pub fn expect_u16(&mut self) -> &mut Expectation

Create an Expectation for mocking the u16 method

source

pub fn expect_u32(&mut self) -> &mut Expectation

Create an Expectation for mocking the u32 method

source

pub fn expect_u64(&mut self) -> &mut Expectation

Create an Expectation for mocking the u64 method

source

pub fn expect_u128(&mut self) -> &mut Expectation

Create an Expectation for mocking the u128 method

source

pub fn expect_usize(&mut self) -> &mut Expectation

Create an Expectation for mocking the usize method

Trait Implementations§

source§

impl Default for MockEnv

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Env for MockEnv

source§

fn all(&self) -> HashMap<String, String>

Returns all environment variables. Read more
source§

fn bool(&self, key: &str) -> Option<Result<bool, ParseBoolError>>

Returns the value of the environment variable key as a bool. Read more
source§

fn char(&self, key: &str) -> Option<Result<char, ParseCharError>>

Returns the value of the environment variable key as a char. Read more
source§

fn f32(&self, key: &str) -> Option<Result<f32, ParseFloatError>>

Returns the value of the environment variable key as a f32. Read more
source§

fn f64(&self, key: &str) -> Option<Result<f64, ParseFloatError>>

Returns the value of the environment variable key as a f64. Read more
source§

fn i8(&self, key: &str) -> Option<Result<i8, ParseIntError>>

Returns the value of the environment variable key as a i8. Read more
source§

fn i16(&self, key: &str) -> Option<Result<i16, ParseIntError>>

Returns the value of the environment variable key as a i16. Read more
source§

fn i32(&self, key: &str) -> Option<Result<i32, ParseIntError>>

Returns the value of the environment variable key as a i32. Read more
source§

fn i64(&self, key: &str) -> Option<Result<i64, ParseIntError>>

Returns the value of the environment variable key as a i64. Read more
source§

fn i128(&self, key: &str) -> Option<Result<i128, ParseIntError>>

Returns the value of the environment variable key as a i128. Read more
source§

fn ip_addr(&self, key: &str) -> Option<Result<IpAddr, AddrParseError>>

Returns the value of the environment variable key as a IpAddr. Read more
source§

fn ipv4_addr(&self, key: &str) -> Option<Result<Ipv4Addr, AddrParseError>>

Returns the value of the environment variable key as a Ipv4Addr. Read more
source§

fn ipv6_addr(&self, key: &str) -> Option<Result<Ipv6Addr, AddrParseError>>

Returns the value of the environment variable key as a Ipv6Addr. Read more
source§

fn isize(&self, key: &str) -> Option<Result<isize, ParseIntError>>

Returns the value of the environment variable key as a isize. Read more
source§

fn non_zero_i8(&self, key: &str) -> Option<Result<NonZeroI8, ParseIntError>>

Returns the value of the environment variable key as a NonZeroI8. Read more
source§

fn non_zero_i16(&self, key: &str) -> Option<Result<NonZeroI16, ParseIntError>>

Returns the value of the environment variable key as a NonZeroI16. Read more
source§

fn non_zero_i32(&self, key: &str) -> Option<Result<NonZeroI32, ParseIntError>>

Returns the value of the environment variable key as a NonZeroI32. Read more
source§

fn non_zero_i64(&self, key: &str) -> Option<Result<NonZeroI64, ParseIntError>>

Returns the value of the environment variable key as a NonZeroI64. Read more
source§

fn non_zero_i128(&self, key: &str) -> Option<Result<NonZeroI128, ParseIntError>>

Returns the value of the environment variable key as a NonZeroI128. Read more
source§

fn non_zero_isize( &self, key: &str ) -> Option<Result<NonZeroIsize, ParseIntError>>

Returns the value of the environment variable key as a NonZeroIsize. Read more
source§

fn non_zero_u8(&self, key: &str) -> Option<Result<NonZeroU8, ParseIntError>>

Returns the value of the environment variable key as a NonZeroU8. Read more
source§

fn non_zero_u16(&self, key: &str) -> Option<Result<NonZeroU16, ParseIntError>>

Returns the value of the environment variable key as a NonZeroU16. Read more
source§

fn non_zero_u32(&self, key: &str) -> Option<Result<NonZeroU32, ParseIntError>>

Returns the value of the environment variable key as a NonZeroU32. Read more
source§

fn non_zero_u64(&self, key: &str) -> Option<Result<NonZeroU64, ParseIntError>>

Returns the value of the environment variable key as a NonZeroU64. Read more
source§

fn non_zero_u128(&self, key: &str) -> Option<Result<NonZeroU128, ParseIntError>>

Returns the value of the environment variable key as a NonZeroU128. Read more
source§

fn non_zero_usize( &self, key: &str ) -> Option<Result<NonZeroUsize, ParseIntError>>

Returns the value of the environment variable key as a NonZeroUsize. Read more
source§

fn os_string(&self, key: &str) -> Option<OsString>

Returns the value of the environment variable key as a OsString. Read more
source§

fn path_buf(&self, key: &str) -> Option<PathBuf>

Returns the value of the environment variable key as a PathBuf. Read more
source§

fn raw(&self, key: &str) -> Result<String, VarError>

Returns the value of the environment variable key as a String. Read more
source§

fn socket_addr(&self, key: &str) -> Option<Result<SocketAddr, AddrParseError>>

Returns the value of the environment variable key as a SocketAddr. Read more
source§

fn socket_addr_v4( &self, key: &str ) -> Option<Result<SocketAddrV4, AddrParseError>>

Returns the value of the environment variable key as a SocketAddrV4. Read more
source§

fn socket_addr_v6( &self, key: &str ) -> Option<Result<SocketAddrV6, AddrParseError>>

Returns the value of the environment variable key as a SocketAddrV6. Read more
source§

fn string(&self, key: &str) -> Option<String>

Returns the value of the environment variable key as a String. Read more
source§

fn strings(&self, key: &str, sep: &str) -> Option<Vec<String>>

Returns the value of the environment variable key as a Vec<String>. Read more
source§

fn u8(&self, key: &str) -> Option<Result<u8, ParseIntError>>

Returns the value of the environment variable key as a u8. Read more
source§

fn u16(&self, key: &str) -> Option<Result<u16, ParseIntError>>

Returns the value of the environment variable key as a u16. Read more
source§

fn u32(&self, key: &str) -> Option<Result<u32, ParseIntError>>

Returns the value of the environment variable key as a u32. Read more
source§

fn u64(&self, key: &str) -> Option<Result<u64, ParseIntError>>

Returns the value of the environment variable key as a u64. Read more
source§

fn u128(&self, key: &str) -> Option<Result<u128, ParseIntError>>

Returns the value of the environment variable key as a u128. Read more
source§

fn usize(&self, key: &str) -> Option<Result<usize, ParseIntError>>

Returns the value of the environment variable key as a usize. 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> Any for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

source§

fn type_name(&self) -> &'static str

source§

impl<T> AnySync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

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
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

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

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

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.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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