pub enum PatchValue<T> {
Set(T),
Unchanged,
}Expand description
Can be used as a parameter in PATCH endpoints to distinguish between
values that should be updated and those that should remain unchanged.
Variants§
Implementations§
Source§impl<T> PatchValue<T>
impl<T> PatchValue<T>
Sourcepub fn update(self, old: T) -> ActiveValue<T>
Available on crate feature sea-orm only.
pub fn update(self, old: T) -> ActiveValue<T>
sea-orm only.Convert this type to a sea_orm::ActiveValue that can be used to
construct an ActiveModel.
Sourcepub fn map<U>(self, f: impl FnOnce(T) -> U) -> PatchValue<U>
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> PatchValue<U>
Convert a PatchValue<T> to a PatchValue<U>.
Trait Implementations§
Source§impl<T: Clone> Clone for PatchValue<T>
impl<T: Clone> Clone for PatchValue<T>
Source§fn clone(&self) -> PatchValue<T>
fn clone(&self) -> PatchValue<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for PatchValue<T>
impl<T: Debug> Debug for PatchValue<T>
Source§impl<T> Default for PatchValue<T>
impl<T> Default for PatchValue<T>
Source§fn default() -> PatchValue<T>
fn default() -> PatchValue<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for PatchValue<T>where
T: Deserialize<'de>,
Available on crate feature serde only.
impl<'de, T> Deserialize<'de> for PatchValue<T>where
T: Deserialize<'de>,
Available on crate feature
serde only.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> ParseFromJSON for PatchValue<T>where
T: ParseFromJSON,
impl<T> ParseFromJSON for PatchValue<T>where
T: ParseFromJSON,
Source§fn parse_from_json(value: Option<Value>) -> ParseResult<Self>
fn parse_from_json(value: Option<Value>) -> ParseResult<Self>
Parse from
serde_json::Value.Source§fn parse_from_json_string(s: &str) -> Result<Self, ParseError<Self>>
fn parse_from_json_string(s: &str) -> Result<Self, ParseError<Self>>
Parse from JSON string.
Source§impl<T: PartialEq> PartialEq for PatchValue<T>
impl<T: PartialEq> PartialEq for PatchValue<T>
Source§impl<T> Serialize for PatchValue<T>where
T: Serialize,
Available on crate feature serde only.
impl<T> Serialize for PatchValue<T>where
T: Serialize,
Available on crate feature
serde only.Source§impl<T> ToJSON for PatchValue<T>where
T: ToJSON,
impl<T> ToJSON for PatchValue<T>where
T: ToJSON,
Source§impl<T> Type for PatchValue<T>where
T: Type,
impl<T> Type for PatchValue<T>where
T: Type,
Source§const IS_REQUIRED: bool = false
const IS_REQUIRED: bool = false
If it is
true, it means that this type is required.Source§type RawValueType = <T as Type>::RawValueType
type RawValueType = <T as Type>::RawValueType
The raw type used for validator. Read more
Source§type RawElementValueType = <T as Type>::RawElementValueType
type RawElementValueType = <T as Type>::RawElementValueType
The raw element type used for validator.
Source§fn schema_ref() -> MetaSchemaRef
fn schema_ref() -> MetaSchemaRef
Get schema reference of this type.
Source§fn as_raw_value(&self) -> Option<&Self::RawValueType>
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Returns a reference to the raw value.
Source§fn raw_element_iter<'a>(
&'a self,
) -> Box<dyn Iterator<Item = &'a Self::RawElementValueType> + 'a>
fn raw_element_iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = &'a Self::RawElementValueType> + 'a>
Returns an iterator for traversing the elements.
impl<T: Copy> Copy for PatchValue<T>
impl<T: Eq> Eq for PatchValue<T>
impl<T> StructuralPartialEq for PatchValue<T>
Auto Trait Implementations§
impl<T> Freeze for PatchValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for PatchValue<T>where
T: RefUnwindSafe,
impl<T> Send for PatchValue<T>where
T: Send,
impl<T> Sync for PatchValue<T>where
T: Sync,
impl<T> Unpin for PatchValue<T>where
T: Unpin,
impl<T> UnwindSafe for PatchValue<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<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 more