Enum TreeModelError

Source
#[non_exhaustive]
pub enum TreeModelError<T: Debug> { DuplicateId { id: T, }, MissingId { id: T, }, ReusedId { id: T, }, ParentIsLeaf { id: T, }, InvalidIndex { index: usize, len: usize, }, Cycle { id: T, new_parent: T, }, NonEmptyBranchToLeaf { id: T, }, NotBranch { id: T, }, RevisionExhausted, StaleRevision { expected: u64, actual: u64, }, }
Expand description

Validation failure for a retained tree mutation. The whole batch is rolled back on error.

§Examples

use ailloli_ui_widgets::controls::TreeModelError;
let error = TreeModelError::DuplicateId { id: 7_u64 };
assert!(error.to_string().contains("already exists"));

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

DuplicateId

An inserted ID is already active.

Fields

§id: T

Active identifier that the insertion attempted to duplicate.

§

MissingId

A referenced item or parent does not exist.

Fields

§id: T

Identifier that could not be resolved in the active model.

§

ReusedId

An inserted ID was previously removed and permanently retired.

Fields

§id: T

Tombstoned identifier that must not be inserted again.

§

ParentIsLeaf

An insertion/move target cannot own children.

Fields

§id: T

Leaf identifier supplied as the requested parent.

§

InvalidIndex

An insertion/move position exceeds its allowed inclusive upper bound.

Fields

§index: usize

Requested zero-based insertion position.

§len: usize

Current child count and inclusive append position.

§

Cycle

A move would make an item its own ancestor.

Fields

§id: T

Identifier of the item being moved.

§new_parent: T

Descendant identifier proposed as the new parent.

§

NonEmptyBranchToLeaf

An update attempted to turn a populated branch into a leaf.

Fields

§id: T

Populated branch identifier whose kind change was rejected.

§

NotBranch

Expansion was requested for a leaf.

Fields

§id: T

Leaf identifier supplied to a branch-only operation.

§

RevisionExhausted

Incrementing the checked u64 revision would overflow.

§

StaleRevision

Optimistic mutation expected a different current revision.

Fields

§expected: u64

Revision required by the optimistic mutation.

§actual: u64

Revision held by the model when validation ran.

Trait Implementations§

Source§

impl<T: Clone + Debug> Clone for TreeModelError<T>

Source§

fn clone(&self) -> TreeModelError<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Debug> Debug for TreeModelError<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Display for TreeModelError<T>
where T: Debug + Debug,

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Debug> Error for TreeModelError<T>
where Self: Debug + Display,

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<TreeModelError<FileTreeNodeId>> for FileTreeModelBridgeError

Source§

fn from(source: TreeModelError<FileTreeNodeId>) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq + Debug> PartialEq for TreeModelError<T>

Source§

fn eq(&self, other: &TreeModelError<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq + Debug> Eq for TreeModelError<T>

Source§

impl<T: Debug> StructuralPartialEq for TreeModelError<T>

Auto Trait Implementations§

§

impl<T> Freeze for TreeModelError<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for TreeModelError<T>
where T: RefUnwindSafe,

§

impl<T> Send for TreeModelError<T>
where T: Send,

§

impl<T> Sync for TreeModelError<T>
where T: Sync,

§

impl<T> Unpin for TreeModelError<T>
where T: Unpin,

§

impl<T> UnwindSafe for TreeModelError<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<A> IntoClickAction<A> for A
where A: Clone + 'static,

§

fn into_click_action(self) -> ClickAction<A>

Implements the into_click_action helper used by this module.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Props for T
where T: Clone + 'static,