pub struct Related<T: Model> { /* private fields */ }Expand description
A related single object (many-to-one or one-to-one).
This wrapper can be in one of three states:
- Empty: no relationship (
fk_valueis None) - Unloaded: has FK value but not fetched yet (
fk_valueis Some,loadedunset) - Loaded: the object has been fetched and cached (
loadedset)
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Related<T>where
T: Model + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Related<T>where
T: Model + Deserialize<'de>,
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> !Freeze for Related<T>
impl<T> RefUnwindSafe for Related<T>where
T: RefUnwindSafe + UnwindSafe,
impl<T> Send for Related<T>
impl<T> Sync for Related<T>
impl<T> Unpin for Related<T>where
T: Unpin,
impl<T> UnwindSafe for Related<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
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> ModelDump for Twhere
T: Serialize,
impl<T> ModelDump for Twhere
T: Serialize,
Source§fn model_dump(&self, options: DumpOptions) -> Result<Value, Error>
fn model_dump(&self, options: DumpOptions) -> Result<Value, Error>
Serialize a model to a JSON value. Read more
Source§fn model_dump_json(&self) -> Result<String, Error>
fn model_dump_json(&self) -> Result<String, Error>
Serialize a model to a JSON string with default options.
Source§fn model_dump_json_pretty(&self) -> Result<String, Error>
fn model_dump_json_pretty(&self) -> Result<String, Error>
Serialize a model to a pretty-printed JSON string.
Source§fn model_dump_json_with_options(
&self,
options: DumpOptions,
) -> Result<String, Error>
fn model_dump_json_with_options( &self, options: DumpOptions, ) -> Result<String, Error>
Serialize a model to a JSON string with full options support. Read more
Source§impl<T> ModelValidate for Twhere
T: DeserializeOwned,
impl<T> ModelValidate for Twhere
T: DeserializeOwned,
Source§fn model_validate(
input: impl Into<ValidateInput>,
options: ValidateOptions,
) -> Result<T, ValidationError>
fn model_validate( input: impl Into<ValidateInput>, options: ValidateOptions, ) -> Result<T, ValidationError>
Create and validate a model from input. Read more
Source§fn model_validate_json(json: &str) -> ValidateResult<Self>
fn model_validate_json(json: &str) -> ValidateResult<Self>
Create and validate a model from JSON string with default options.
Source§fn model_validate_dict(dict: HashMap<String, Value>) -> ValidateResult<Self>
fn model_validate_dict(dict: HashMap<String, Value>) -> ValidateResult<Self>
Create and validate a model from a HashMap with default options.