pub enum VersionUpgradePolicy {
AsIs,
UpgradeToV2,
UpgradeToV3,
}Expand description
How to handle decoding DBN data from other versions.
Variants§
AsIs
Decode data from all supported versions (less than or equal to
DBN_VERSION) as-is.
UpgradeToV2
Decode and convert data from DBN versions prior to version 2 to that version. Attempting to decode data from newer versions will fail.
UpgradeToV3
Decode and convert data from DBN versions prior to version 3 to that version. Attempting to decode data from newer versions (when they’re introduced) will fail.
Implementations§
Source§impl VersionUpgradePolicy
impl VersionUpgradePolicy
Sourcepub fn validate_compatibility(self, version: u8) -> Result<()>
pub fn validate_compatibility(self, version: u8) -> Result<()>
Validates a given DBN version is compatible with the upgrade policy.
§Errors
This function returns an error if the version and upgrade policy are incompatible.
Sourcepub fn output_version(self, input_version: u8) -> u8
pub fn output_version(self, input_version: u8) -> u8
Returns the output DBN version given the input version and upgrade policy.
Trait Implementations§
Source§impl Clone for VersionUpgradePolicy
impl Clone for VersionUpgradePolicy
Source§fn clone(&self) -> VersionUpgradePolicy
fn clone(&self) -> VersionUpgradePolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VersionUpgradePolicy
impl Debug for VersionUpgradePolicy
Source§impl Default for VersionUpgradePolicy
impl Default for VersionUpgradePolicy
Source§fn default() -> VersionUpgradePolicy
fn default() -> VersionUpgradePolicy
Source§impl<'a, 'py> FromPyObject<'a, 'py> for VersionUpgradePolicywhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for VersionUpgradePolicywhere
Self: Clone,
Source§impl Hash for VersionUpgradePolicy
impl Hash for VersionUpgradePolicy
Source§impl<'py> IntoPyObject<'py> for VersionUpgradePolicy
impl<'py> IntoPyObject<'py> for VersionUpgradePolicy
Source§type Target = VersionUpgradePolicy
type Target = VersionUpgradePolicy
Source§type Output = Bound<'py, <VersionUpgradePolicy as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <VersionUpgradePolicy as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'py>>::Output, <Self as IntoPyObject<'py>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'py>>::Output, <Self as IntoPyObject<'py>>::Error>
Source§impl Ord for VersionUpgradePolicy
impl Ord for VersionUpgradePolicy
Source§fn cmp(&self, other: &VersionUpgradePolicy) -> Ordering
fn cmp(&self, other: &VersionUpgradePolicy) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for VersionUpgradePolicy
impl PartialEq for VersionUpgradePolicy
Source§impl PartialOrd for VersionUpgradePolicy
impl PartialOrd for VersionUpgradePolicy
Source§impl PyClass for VersionUpgradePolicy
impl PyClass for VersionUpgradePolicy
Source§impl PyClassImpl for VersionUpgradePolicy
impl PyClassImpl for VersionUpgradePolicy
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// How to handle decoding DBN data from other versions.
const RAW_DOC: &'static CStr = /// How to handle decoding DBN data from other versions.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<VersionUpgradePolicy as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<VersionUpgradePolicy>
type Layout = <<VersionUpgradePolicy as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<VersionUpgradePolicy>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
Source§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
Source§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClass__eq__SlotFragment<VersionUpgradePolicy> for PyClassImplCollector<VersionUpgradePolicy>
Available on crate feature python only.
impl PyClass__eq__SlotFragment<VersionUpgradePolicy> for PyClassImplCollector<VersionUpgradePolicy>
python only.Source§impl PyMethods<VersionUpgradePolicy> for PyClassImplCollector<VersionUpgradePolicy>
Available on crate feature python only.
impl PyMethods<VersionUpgradePolicy> for PyClassImplCollector<VersionUpgradePolicy>
python only.fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for VersionUpgradePolicy
impl PyTypeInfo for VersionUpgradePolicy
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Source§impl WritePyRepr for VersionUpgradePolicy
Available on crate feature python only.
impl WritePyRepr for VersionUpgradePolicy
python only.Source§fn write_py_repr(&self, s: &mut String) -> Result
fn write_py_repr(&self, s: &mut String) -> Result
s. Read moreSource§const SHOULD_FLATTEN: bool = false
const SHOULD_FLATTEN: bool = false
impl Copy for VersionUpgradePolicy
impl Eq for VersionUpgradePolicy
impl StructuralPartialEq for VersionUpgradePolicy
Auto Trait Implementations§
impl Freeze for VersionUpgradePolicy
impl RefUnwindSafe for VersionUpgradePolicy
impl Send for VersionUpgradePolicy
impl Sync for VersionUpgradePolicy
impl Unpin for VersionUpgradePolicy
impl UnsafeUnpin for VersionUpgradePolicy
impl UnwindSafe for VersionUpgradePolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.