pub struct TestEntity {
pub id: String,
pub value: i32,
}Expand description
Test entity for JSON serialization tests
This is a simple entity used across multiple tests to verify serialization, deserialization, and persistence operations.
§Examples
use torrust_tracker_deployer_lib::testing::fixtures::TestEntity;
// Create with default values
let entity = TestEntity::default();
assert_eq!(entity.id, "test-id");
assert_eq!(entity.value, 42);
// Create with custom values
let entity = TestEntity::new("custom-id", 100);
assert_eq!(entity.id, "custom-id");
assert_eq!(entity.value, 100);Fields§
§id: String§value: i32Implementations§
Source§impl TestEntity
impl TestEntity
Sourcepub fn new(id: impl Into<String>, value: i32) -> Self
pub fn new(id: impl Into<String>, value: i32) -> Self
Create a test entity with custom values
§Arguments
id- The entity ID (can be any type that converts to String)value- The entity value
§Examples
use torrust_tracker_deployer_lib::testing::fixtures::TestEntity;
let entity = TestEntity::new("my-id", 100);
assert_eq!(entity.id, "my-id");
assert_eq!(entity.value, 100);Trait Implementations§
Source§impl Clone for TestEntity
impl Clone for TestEntity
Source§impl Debug for TestEntity
impl Debug for TestEntity
Source§impl Default for TestEntity
impl Default for TestEntity
Source§impl<'de> Deserialize<'de> for TestEntity
impl<'de> Deserialize<'de> for TestEntity
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
impl Eq for TestEntity
Source§impl PartialEq for TestEntity
impl PartialEq for TestEntity
Source§impl Serialize for TestEntity
impl Serialize for TestEntity
impl StructuralPartialEq for TestEntity
Auto Trait Implementations§
impl Freeze for TestEntity
impl RefUnwindSafe for TestEntity
impl Send for TestEntity
impl Sync for TestEntity
impl Unpin for TestEntity
impl UnsafeUnpin for TestEntity
impl UnwindSafe for TestEntity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request