pub struct TestMessage<T = Empty> {
pub tested_node: TestableNode,
pub msg_id: u32,
pub total_msgs: u32,
pub ext: T,
}Fields§
§tested_node: TestableNode§msg_id: u32§total_msgs: u32§ext: TImplementations§
Source§impl<T> TestMessage<T>
impl<T> TestMessage<T>
pub fn new( tested_node: TestableNode, msg_id: u32, total_msgs: u32, ext: T, ) -> Self
pub fn new_mix(node: &RoutingNode, msg_id: u32, total_msgs: u32, ext: T) -> Self
pub fn new_gateway( node: &RoutingNode, msg_id: u32, total_msgs: u32, ext: T, ) -> Self
pub fn new_plaintexts( node: TestableNode, total_msgs: u32, ext: T, ) -> Result<Vec<Vec<u8>>, NetworkTestingError>
pub fn mix_plaintexts( node: &RoutingNode, total_msgs: u32, ext: T, ) -> Result<Vec<Vec<u8>>, NetworkTestingError>
pub fn legacy_gateway_plaintexts( node: &RoutingNode, total_msgs: u32, ext: T, ) -> Result<Vec<Vec<u8>>, NetworkTestingError>
pub fn as_json_string(&self) -> Result<String, NetworkTestingError>where
T: Serialize,
pub fn as_bytes(&self) -> Result<Vec<u8>, NetworkTestingError>where
T: Serialize,
pub fn try_recover(msg: NymMessage) -> Result<Self, NetworkTestingError>where
T: DeserializeOwned,
pub fn try_recover_from_bytes(raw: &[u8]) -> Result<Self, NetworkTestingError>where
T: DeserializeOwned,
Trait Implementations§
Source§impl<T: Clone> Clone for TestMessage<T>
impl<T: Clone> Clone for TestMessage<T>
Source§impl<'de, T> Deserialize<'de> for TestMessage<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for TestMessage<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> From<TestMessage<T>> for Received<T>
impl<T> From<TestMessage<T>> for Received<T>
Source§fn from(value: TestMessage<T>) -> Self
fn from(value: TestMessage<T>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> Forget for TestMessage<T>
impl<T> Freeze for TestMessage<T>where
T: Freeze,
impl<T> Move for TestMessage<T>
impl<T> RefUnwindSafe for TestMessage<T>where
T: RefUnwindSafe,
impl<T> Send for TestMessage<T>where
T: Send,
impl<T> Sync for TestMessage<T>where
T: Sync,
impl<T> Unpin for TestMessage<T>where
T: Unpin,
impl<T> UnsafeUnpin for TestMessage<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TestMessage<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Deprecatable for T
impl<T> Deprecatable for T
fn deprecate(self) -> Deprecated<Self>where
Self: Sized,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> OptionalSet for T
impl<T> OptionalSet for T
Source§fn with_optional<F, T>(self, f: F, val: Option<T>) -> Self
fn with_optional<F, T>(self, f: F, val: Option<T>) -> Self
If the value is available (i.e.
Some), the provided closure is applied.
Otherwise self is returned with no modifications.Source§fn with_validated_optional<F, T, V, E>(
self,
f: F,
value: Option<T>,
validate: V,
) -> Result<Self, E>
fn with_validated_optional<F, T, V, E>( self, f: F, value: Option<T>, validate: V, ) -> Result<Self, E>
If the value is available (i.e.
Some) it is validated and then the provided closure is applied.
Otherwise self is returned with no modifications.Source§fn with_optional_env<F, T>(self, f: F, val: Option<T>, env_var: &str) -> Self
fn with_optional_env<F, T>(self, f: F, val: Option<T>, env_var: &str) -> Self
If the value is available (i.e.
Some), the provided closure is applied.
Otherwise, if the environment was configured and the corresponding variable was set,
the value is parsed using the FromStr implementation and the closure is applied on that instead.
Finally, if none of those were available, self is returned with no modifications.Source§fn with_optional_custom_env<F, T, G>(
self,
f: F,
val: Option<T>,
env_var: &str,
parser: G,
) -> Self
fn with_optional_custom_env<F, T, G>( self, f: F, val: Option<T>, env_var: &str, parser: G, ) -> Self
If the value is available (i.e.
Some), the provided closure is applied.
Otherwise, if the environment was configured and the corresponding variable was set,
the value is parsed using the provided parser and the closure is applied on that instead.
Finally, if none of those were available, self is returned with no modifications.