pub enum MutationState {
Idle,
Pending {
generation: u64,
},
Succeeded {
generation: u64,
},
Failed {
generation: u64,
message: &'static str,
},
}Expand description
mutation 状态机:query 的简化版,成功/失败后回到 Idle,不保留数据快照。
Variants§
Implementations§
Source§impl MutationState
impl MutationState
pub fn request(&mut self, generation: u64) -> bool
pub fn succeed(&mut self, generation: u64) -> bool
Sourcepub fn fail(&mut self, generation: u64, message: &'static str) -> bool
pub fn fail(&mut self, generation: u64, message: &'static str) -> bool
message 为静态串:MutationState 是 Copy,符合“错误状态轻量可复制“的约束。
pub fn cancel(&mut self) -> bool
pub fn is_pending(&self) -> bool
Trait Implementations§
Source§impl Clone for MutationState
impl Clone for MutationState
impl Copy for MutationState
Source§impl Debug for MutationState
impl Debug for MutationState
Source§impl Default for MutationState
impl Default for MutationState
impl Eq for MutationState
Source§impl PartialEq for MutationState
impl PartialEq for MutationState
impl StructuralPartialEq for MutationState
Auto Trait Implementations§
impl Forget for MutationState
impl Freeze for MutationState
impl Move for MutationState
impl RefUnwindSafe for MutationState
impl Send for MutationState
impl Sync for MutationState
impl Unpin for MutationState
impl UnsafeUnpin for MutationStatewhere
&'static str: UnsafeUnpin,
impl UnwindSafe for MutationStatewhere
&'static str: UnwindSafe,
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