pub enum CopyError {
AttributeAfterContent {
name: String,
},
AttributeOutsideElement {
name: String,
},
SchemaMismatch,
Unsupported(&'static str),
Document(BufferDocumentError),
Atomize(XPathError),
}Expand description
Why a node could not be copied.
use bumpalo::Bump;
use xsd_schema::document::{BufferDocument, BufferDocumentBuilder};
use xsd_schema::document::{BufferDocumentOptions, CopyError, CopyOptions};
use xsd_schema::namespace::NameTable;
use xsd_schema::navigator::DomNavigator;
let arena = Bump::new();
let names = NameTable::new();
let source = BufferDocument::from_reader_default(r#"<a k="v"/>"#.as_bytes(), &arena, &names)?;
let mut attr = source.create_navigator();
attr.move_to_first_child();
attr.move_to_first_attribute();
// Nothing is open, so there is no element to put the attribute on.
let mut builder =
BufferDocumentBuilder::new(&arena, &names, None, BufferDocumentOptions::default())?;
match builder.copy_attribute(&attr, CopyOptions::default()) {
Err(CopyError::AttributeOutsideElement { name }) => assert_eq!(name, "k"),
other => panic!("expected a refusal, got {other:?}"),
}Variants§
AttributeAfterContent
An attribute was appended to an element that already has a child (XQuery XQTY0024).
AttributeOutsideElement
An attribute was appended with no element open, i.e. at document level (XQuery XQTY0024).
SchemaMismatch
Annotations::Preserve was asked for, but the source document is
bound to a different SchemaSet than the document being built, so
its type keys mean nothing here.
Unsupported(&'static str)
A node kind this copy cannot represent: a namespace node used as
content, or a node that is not an attribute passed to
copy_attribute.
Document(BufferDocumentError)
The builder refused the node (the document is full, or an element was closed that was never opened).
Atomize(XPathError)
An atomic item could not be atomized to a string value.
Trait Implementations§
Source§impl Error for CopyError
impl Error for CopyError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<BufferDocumentError> for CopyError
impl From<BufferDocumentError> for CopyError
Source§fn from(source: BufferDocumentError) -> Self
fn from(source: BufferDocumentError) -> Self
Converts to this type from the input type.
Source§impl From<CopyError> for ComposeError
impl From<CopyError> for ComposeError
Source§impl From<XPathError> for CopyError
impl From<XPathError> for CopyError
Source§fn from(source: XPathError) -> Self
fn from(source: XPathError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for CopyError
impl !UnwindSafe for CopyError
impl Forget for CopyError
impl Freeze for CopyErrorwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
&'static str: Freeze,
*const () is !null: Freeze,
PhantomData<ErrorData<CustomOwner>>: Freeze,
*const str is !null: Freeze,
PhantomData<str>: Freeze,
*const ArcInner<RaisedErrorData> is !null: Freeze,
PhantomData<ArcInner<RaisedErrorData>>: Freeze,
impl Move for CopyError
impl Send for CopyError
impl Sync for CopyError
impl Unpin for CopyError
impl UnsafeUnpin for CopyErrorwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
&'static str: UnsafeUnpin,
*const () is !null: UnsafeUnpin,
PhantomData<ErrorData<CustomOwner>>: UnsafeUnpin,
*const str is !null: UnsafeUnpin,
PhantomData<str>: UnsafeUnpin,
*const ArcInner<RaisedErrorData> is !null: UnsafeUnpin,
PhantomData<ArcInner<RaisedErrorData>>: UnsafeUnpin,
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