pub trait WithSchema {
// Required method
fn schema(version: u32, context: &mut WithSchemaContext) -> Schema;
}Expand description
This trait must be implemented by all data structures you wish to be able to save.
It must encode the schema for the datastructure when saved using the given version number. When files are saved, the schema is encoded into the file. when loading, the schema is inspected to make sure that the load will safely succeed. This is only for increased safety, the file format does not in fact use the schema for any other purpose, the design is schema-less at the core, the schema is just an added layer of safety (which can be disabled).
Required Methods§
Sourcefn schema(version: u32, context: &mut WithSchemaContext) -> Schema
fn schema(version: u32, context: &mut WithSchemaContext) -> Schema
Returns a representation of the schema used by this Serialize implementation for the given version. The WithSchemaContext can be used to guard against recursive data structures. See documentation of WithSchemaContext.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl WithSchema for &str
impl WithSchema for &str
Source§impl WithSchema for IpAddr
impl WithSchema for IpAddr
Source§impl WithSchema for SocketAddr
impl WithSchema for SocketAddr
Source§impl WithSchema for bool
impl WithSchema for bool
Source§impl WithSchema for char
impl WithSchema for char
Source§impl WithSchema for f32
impl WithSchema for f32
Source§impl WithSchema for f64
impl WithSchema for f64
Source§impl WithSchema for i8
impl WithSchema for i8
Source§impl WithSchema for i16
impl WithSchema for i16
Source§impl WithSchema for i32
impl WithSchema for i32
Source§impl WithSchema for i64
impl WithSchema for i64
Source§impl WithSchema for i128
impl WithSchema for i128
Source§impl WithSchema for isize
impl WithSchema for isize
Source§impl WithSchema for str
impl WithSchema for str
Source§impl WithSchema for u8
impl WithSchema for u8
Source§impl WithSchema for u16
impl WithSchema for u16
Source§impl WithSchema for u32
impl WithSchema for u32
Source§impl WithSchema for u64
impl WithSchema for u64
Source§impl WithSchema for u128
impl WithSchema for u128
Source§impl WithSchema for ()
impl WithSchema for ()
Source§impl WithSchema for usize
impl WithSchema for usize
Source§impl WithSchema for String
impl WithSchema for String
Source§impl WithSchema for Arc<str>
impl WithSchema for Arc<str>
Source§impl WithSchema for AtomicBool
impl WithSchema for AtomicBool
Source§impl WithSchema for AtomicI8
impl WithSchema for AtomicI8
Source§impl WithSchema for AtomicI16
impl WithSchema for AtomicI16
Source§impl WithSchema for AtomicI32
impl WithSchema for AtomicI32
Source§impl WithSchema for AtomicI64
impl WithSchema for AtomicI64
Source§impl WithSchema for AtomicIsize
impl WithSchema for AtomicIsize
Source§impl WithSchema for AtomicU8
impl WithSchema for AtomicU8
Source§impl WithSchema for AtomicU16
impl WithSchema for AtomicU16
Source§impl WithSchema for AtomicU32
impl WithSchema for AtomicU32
Source§impl WithSchema for AtomicU64
impl WithSchema for AtomicU64
Source§impl WithSchema for AtomicUsize
impl WithSchema for AtomicUsize
Source§impl WithSchema for Duration
impl WithSchema for Duration
Source§impl WithSchema for Error
impl WithSchema for Error
Source§impl WithSchema for PathBuf
impl WithSchema for PathBuf
Source§impl WithSchema for SystemTime
impl WithSchema for SystemTime
Source§impl WithSchema for BitSet
Available on crate feature bit-set only.
impl WithSchema for BitSet
bit-set only.Source§impl WithSchema for BitSet
Available on crate feature bit-set only.
impl WithSchema for BitSet
bit-set only.Source§impl WithSchema for BitVec
Available on crate feature bit-vec only.
impl WithSchema for BitVec
bit-vec only.Source§impl WithSchema for BitVec
Available on crate feature bit-vec08 only.
impl WithSchema for BitVec
bit-vec08 only.Source§impl WithSchema for DateTime<Utc>
Available on crate feature chrono only.
impl WithSchema for DateTime<Utc>
chrono only.Source§impl<'a, T: 'a + WithSchema + ToOwned + ?Sized> WithSchema for Cow<'a, T>
impl<'a, T: 'a + WithSchema + ToOwned + ?Sized> WithSchema for Cow<'a, T>
Source§impl<K: WithSchema + Eq + Hash, S: BuildHasher> WithSchema for IndexSet<K, S>
Available on crate feature indexmap only.
impl<K: WithSchema + Eq + Hash, S: BuildHasher> WithSchema for IndexSet<K, S>
indexmap only.Source§impl<K: WithSchema + Eq + Hash, V: WithSchema, S: BuildHasher> WithSchema for HashMap<K, V, S>
impl<K: WithSchema + Eq + Hash, V: WithSchema, S: BuildHasher> WithSchema for HashMap<K, V, S>
Source§impl<K: WithSchema + Eq + Hash, V: WithSchema, S: BuildHasher> WithSchema for IndexMap<K, V, S>
Available on crate feature indexmap only.
impl<K: WithSchema + Eq + Hash, V: WithSchema, S: BuildHasher> WithSchema for IndexMap<K, V, S>
indexmap only.Source§impl<K: WithSchema> WithSchema for BTreeSet<K>
impl<K: WithSchema> WithSchema for BTreeSet<K>
Source§impl<K: WithSchema, S: BuildHasher> WithSchema for HashSet<K, S>
impl<K: WithSchema, S: BuildHasher> WithSchema for HashSet<K, S>
Source§impl<K: WithSchema, V: WithSchema> WithSchema for BTreeMap<K, V>
impl<K: WithSchema, V: WithSchema> WithSchema for BTreeMap<K, V>
Source§impl<T1: WithSchema> WithSchema for (T1,)
impl<T1: WithSchema> WithSchema for (T1,)
Source§impl<T1: WithSchema> WithSchema for Range<T1>
impl<T1: WithSchema> WithSchema for Range<T1>
Source§impl<T1: WithSchema, T2: WithSchema> WithSchema for (T1, T2)
impl<T1: WithSchema, T2: WithSchema> WithSchema for (T1, T2)
Source§impl<T1: WithSchema, T2: WithSchema, T3: WithSchema> WithSchema for (T1, T2, T3)
impl<T1: WithSchema, T2: WithSchema, T3: WithSchema> WithSchema for (T1, T2, T3)
Source§impl<T> WithSchema for PhantomData<T>
impl<T> WithSchema for PhantomData<T>
Source§impl<T: Array> WithSchema for SmallVec<T>where
T::Item: WithSchema,
Available on crate feature smallvec only.
impl<T: Array> WithSchema for SmallVec<T>where
T::Item: WithSchema,
smallvec only.Source§impl<T: WithSchema> WithSchema for &[T]
impl<T: WithSchema> WithSchema for &[T]
Source§impl<T: WithSchema> WithSchema for Option<T>
impl<T: WithSchema> WithSchema for Option<T>
Source§impl<T: WithSchema> WithSchema for Box<[T]>
impl<T: WithSchema> WithSchema for Box<[T]>
Source§impl<T: WithSchema> WithSchema for Box<T>
impl<T: WithSchema> WithSchema for Box<T>
Source§impl<T: WithSchema> WithSchema for BinaryHeap<T>
impl<T: WithSchema> WithSchema for BinaryHeap<T>
Source§impl<T: WithSchema> WithSchema for VecDeque<T>
impl<T: WithSchema> WithSchema for VecDeque<T>
Source§impl<T: WithSchema> WithSchema for Rc<T>
impl<T: WithSchema> WithSchema for Rc<T>
Source§impl<T: WithSchema> WithSchema for Arc<[T]>
impl<T: WithSchema> WithSchema for Arc<[T]>
Source§impl<T: WithSchema> WithSchema for Arc<T>
impl<T: WithSchema> WithSchema for Arc<T>
Source§impl<T: WithSchema> WithSchema for Vec<T>
impl<T: WithSchema> WithSchema for Vec<T>
Source§impl<T: WithSchema> WithSchema for Cell<T>
impl<T: WithSchema> WithSchema for Cell<T>
Source§impl<T: WithSchema> WithSchema for RefCell<T>
impl<T: WithSchema> WithSchema for RefCell<T>
Source§impl<T: WithSchema> WithSchema for Mutex<T>
impl<T: WithSchema> WithSchema for Mutex<T>
Source§impl<T: WithSchema> WithSchema for Mutex<T>
Available on crate feature parking_lot only.
impl<T: WithSchema> WithSchema for Mutex<T>
parking_lot only.Source§impl<T: WithSchema> WithSchema for RwLock<T>
Available on crate feature parking_lot only.
impl<T: WithSchema> WithSchema for RwLock<T>
parking_lot only.Source§impl<T: WithSchema, R: WithSchema> WithSchema for Result<T, R>
impl<T: WithSchema, R: WithSchema> WithSchema for Result<T, R>
Source§impl<T: WithSchema, const N: usize> WithSchema for [T; N]
impl<T: WithSchema, const N: usize> WithSchema for [T; N]
Source§impl<V: WithSchema, const C: usize> WithSchema for ArrayVec<V, C>
Available on crate feature arrayvec only.
impl<V: WithSchema, const C: usize> WithSchema for ArrayVec<V, C>
arrayvec only.Source§impl<const C: usize> WithSchema for ArrayString<C>
Available on crate feature arrayvec only.
impl<const C: usize> WithSchema for ArrayString<C>
arrayvec only.