INNER CODE UNIT · Rust

default

pamburus/hl · crates/enumset-serde/src/lib.rs:20

    fn default() -> Self {
        Self(EnumSet::new())
    }
}

impl<'de, T: EnumSetType + de::Deserialize<'de>> de::Visitor<'de> for EnumSetDeserializer<T> {
    type Value = EnumSet<T>;

    fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        formatter.write_str("a list of enum values or a comma-separated list of enum values")
    }

    fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
    where
        A: serde::de::SeqAccess<'de>,
    {
        let mut set = EnumSet::new();
        while let Some(value) = seq.next_element()? {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…