Skip to main content

SerializeFilter

Trait SerializeFilter 

Source
pub trait SerializeFilter<T: ?Sized> {
    // Required methods
    fn skip(&self, field: Field<'_, T>) -> bool;
    fn filtered_len(&self, len: Option<usize>) -> Option<usize>;
}
Expand description

Trait implemented by types which can be used to filter the serializable fields of another type.

Required Methods§

Source

fn skip(&self, field: Field<'_, T>) -> bool

Returns whether the specified field should be skipped.

Source

fn filtered_len(&self, len: Option<usize>) -> Option<usize>

Returns the number of fields which will be serialized given the total field count.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, K, V> SerializeFilter<BTreeMap<K, V>> for BTreeSet<Field<'a, BTreeMap<K, V>>>

Source§

fn skip(&self, field: Field<'_, BTreeMap<K, V>>) -> bool

Source§

fn filtered_len(&self, _len: Option<usize>) -> Option<usize>

Source§

impl<'a, K, V, S> SerializeFilter<HashMap<K, V, S>> for HashSet<Field<'a, HashMap<K, V, S>>, S>
where S: BuildHasher,

Source§

fn skip(&self, field: Field<'_, HashMap<K, V, S>>) -> bool

Source§

fn filtered_len(&self, _len: Option<usize>) -> Option<usize>

Implementors§

Source§

impl<'a, T, F> SerializeFilter<T> for InverseFilter<'a, T, F>
where T: ?Sized + SerializePartial<'a>, F: SerializeFilter<T>,