pub struct ValueEnum {
pub variant: String,
pub path: Option<String>,
pub payload: Option<Box<Value>>,
}Expand description
ValueEnum
handles the Enum case; path is optional to allow strict (typed) or loose matching.
Fields§
§variant: String§path: Option<String>§payload: Option<Box<Value>>Implementations§
Source§impl ValueEnum
impl ValueEnum
Sourcepub fn new(variant: &str, path: Option<&str>) -> Self
pub fn new(variant: &str, path: Option<&str>) -> Self
Build a strict enum value matching the provided variant and path.
Sourcepub fn loose(variant: &str) -> Self
pub fn loose(variant: &str) -> Self
Build an enum value that ignores the path for loose matching.
Sourcepub fn with_payload(self, payload: Value) -> Self
pub fn with_payload(self, payload: Value) -> Self
Attach an enum payload (used for data-carrying variants).
Trait Implementations§
Source§impl CandidType for ValueEnum
impl CandidType for ValueEnum
Source§impl<'de> Deserialize<'de> for ValueEnum
impl<'de> Deserialize<'de> for ValueEnum
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 PartialOrd for ValueEnum
impl PartialOrd for ValueEnum
impl Eq for ValueEnum
impl StructuralPartialEq for ValueEnum
Auto Trait Implementations§
impl Freeze for ValueEnum
impl RefUnwindSafe for ValueEnum
impl Send for ValueEnum
impl Sync for ValueEnum
impl Unpin for ValueEnum
impl UnwindSafe for ValueEnum
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