pub trait Cast: Sized {
const COLUMNS: &'static [ColumnSpec];
const NULLABLE: bool = false;
const SENSITIVE: bool = false;
const MOVES: Option<Moves<Self>> = None;
const HOLDS_STATES: bool = _;
// Required methods
fn encode(&self, out: &mut Vec<SqlValue>);
fn decode(row: &mut dyn ColumnReader) -> Result<Self>;
// Provided method
fn refuse_unlisted_move(
field: &str,
stored: &Self,
current: &Self,
) -> Result<()> { ... }
}Required Associated Constants§
const COLUMNS: &'static [ColumnSpec]
Provided Associated Constants§
const NULLABLE: bool = false
Sourceconst SENSITIVE: bool = false
const SENSITIVE: bool = false
A field holding it is never filtered, sorted, listed or searched, as #[sensitive] ones.
Sourceconst MOVES: Option<Moves<Self>> = None
const MOVES: Option<Moves<Self>> = None
Set for a value moving between listed states; a save of any other value skips the check.
Sourceconst HOLDS_STATES: bool = _
const HOLDS_STATES: bool = _
Set when a state anywhere in the value is checked on save, as a field’s of several.
Required Methods§
fn encode(&self, out: &mut Vec<SqlValue>)
fn decode(row: &mut dyn ColumnReader) -> Result<Self>
Provided Methods§
fn refuse_unlisted_move( field: &str, stored: &Self, current: &Self, ) -> Result<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: Cast> Cast for Option<T>
Only all-null columns read back as None, so an Option of a value that can be all nulls
(an Option, or a value of several fields that are all optional) is refused when compiled:
impl<T: Cast> Cast for Option<T>
Only all-null columns read back as None, so an Option of a value that can be all nulls
(an Option, or a value of several fields that are all optional) is refused when compiled:
ⓘ
use sofie_core::Cast;
let _ = <Option<Option<i64>>>::COLUMNS;