#[non_exhaustive]pub enum TreeEditError {
Show 16 variants
Stale(StaleNode),
NotANode {
kind: SyntaxKind,
},
NotAToken {
kind: SyntaxKind,
},
NoParent,
NotSiblings,
Position {
position: usize,
len: usize,
},
ReadOnly {
kind: SyntaxKind,
},
Misplaced {
kind: SyntaxKind,
parent: SyntaxKind,
},
TagContext,
InvalidToken {
kind: SyntaxKind,
},
Syntax {
code: Code,
},
EmptyFragment,
NotWellFormed,
Limit {
code: Code,
},
Capacity,
Internal,
}Expand description
Why an edit of a SyntaxTree was refused. The tree is unchanged
when an edit fails.
A distinct name from oneyaml’s own EditError: the
oneyaml crate maps this type and never re-exports it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Stale(StaleNode)
A handle names no live element of this tree.
NotANode
Children were to be added under a token.
Fields
kind: SyntaxKindThe token’s kind.
NotAToken
A token operation was given a node.
Fields
kind: SyntaxKindThe node’s kind.
NoParent
The element has no parent (the stream root cannot be removed, replaced, or given siblings).
NotSiblings
The two ends of a range are not siblings, or the last comes before the first.
Position
A child position past the end.
ReadOnly
The element cannot be changed this way: the inside of a scalar,
alias, or error node; directives (they change the meaning of the
whole document); tag properties and block scalar headers (their
meaning is carried by the node: replace the node instead); tokens
whose text cannot be replaced in place. kind: Error also for an
edit that could change how recovered input reads (see
Recovered input in the module docs).
Fields
kind: SyntaxKindThe kind refused.
Misplaced
A fragment element may not sit under that parent (a stream anywhere, a document outside the stream, a YAML node directly in the stream).
TagContext
The fragment has tags resolved under other %TAG directives than
the document it would go into.
InvalidToken
Replacement text does not read as exactly one token of the kind it replaces.
Fields
kind: SyntaxKindThe token kind expected.
Syntax
Fragment text does not parse cleanly: the first error’s code.
EmptyFragment
An empty fragment cannot be inserted.
NotWellFormed
The edit is not well-formed: the text around it, read again through the parser, would not give the tree the edit produces (it has errors, or another structure). See the Well-formed edits section of the module docs for the exact rule.
Limit
The edit would exceed one of the tree’s
Limits (limits apply to edits): the
code of the limit diagnostic the edited text would re-parse with
(Y2000 max_depth, counted from the tree’s root; Y2001
max_scalar_len; Y2002 max_document_size; Y2003
max_documents).
Capacity
The slot space (2³² elements over the tree’s lifetime) or a fragment’s 4 GiB is exhausted.
Internal
An internal invariant failed (a bug; Y9000).
Trait Implementations§
Source§impl Clone for TreeEditError
impl Clone for TreeEditError
impl Copy for TreeEditError
Source§impl Debug for TreeEditError
impl Debug for TreeEditError
Source§impl Display for TreeEditError
impl Display for TreeEditError
impl Eq for TreeEditError
Source§impl Error for TreeEditError
impl Error for TreeEditError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()