pub enum AutoStrategy {
Uuid(UuidVersion),
Increment,
}Expand description
Strategy for automatically populating a field’s value on insert.
When a field has an AutoStrategy, Toasty generates the value
automatically when a new record is created, rather than requiring the
caller to supply it.
§Examples
use toasty_core::schema::app::{AutoStrategy, UuidVersion};
let strategy = AutoStrategy::Uuid(UuidVersion::V4);
assert!(!strategy.is_increment());
let inc = AutoStrategy::Increment;
assert!(inc.is_increment());Variants§
Uuid(UuidVersion)
Generate a UUID of the specified version.
Increment
Use an auto-incrementing integer sequence (database-assigned).
Implementations§
Source§impl AutoStrategy
impl AutoStrategy
Sourcepub fn is_increment(&self) -> bool
pub fn is_increment(&self) -> bool
Returns true if this strategy is AutoStrategy::Increment.
§Examples
use toasty_core::schema::app::AutoStrategy;
let inc = AutoStrategy::Increment;
assert!(inc.is_increment());Trait Implementations§
Source§impl Clone for AutoStrategy
impl Clone for AutoStrategy
Source§fn clone(&self) -> AutoStrategy
fn clone(&self) -> AutoStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AutoStrategy
impl RefUnwindSafe for AutoStrategy
impl Send for AutoStrategy
impl Sync for AutoStrategy
impl Unpin for AutoStrategy
impl UnwindSafe for AutoStrategy
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
Mutably borrows from an owned value. Read more