pub struct WriteError {
pub message: String,
pub report: Option<WriteReport>,
pub path: Option<String>,
pub code: Option<String>,
}Expand description
An in-memory Document could not be written – raised by
crate::oml::write_oml (depth guard only; OML is otherwise lossless
for every Document – see that module’s doc comment) and, from issue
#16 onward, by strict=true format writers via
crate::report::finish_write, mirroring Python’s
WriteError(str(rep), report=rep). The optional crate::report::WriteReport
carries the adjustments that triggered a strict-mode raise; None for
every other WriteError site (e.g. the depth guard, which has no
report to attach).
Fields§
§message: StringHuman-readable write failure description.
report: Option<WriteReport>Optional accumulated WriteReport when written in strict mode.
path: Option<String>The Document path of the value that could not be written, when the
failure is one the spec’s taxonomy names (omnist-spec §8.3.8 and
§8.3.9); None otherwise.
code: Option<String>The spec’s stable code for the failure (write.unsupported-value,
format.multiple-roots, …); None when the taxonomy has no code
for it.
Implementations§
Source§impl WriteError
impl WriteError
Sourcepub fn with_diagnostic(
path: impl Into<String>,
code: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn with_diagnostic( path: impl Into<String>, code: impl Into<String>, message: impl Into<String>, ) -> Self
Construct a WriteError that carries the structured (path, code)
diagnostic the spec’s taxonomy assigns to it.
Sourcepub fn with_report(message: impl Into<String>, report: WriteReport) -> Self
pub fn with_report(message: impl Into<String>, report: WriteReport) -> Self
Construct a WriteError carrying the crate::report::WriteReport
that caused a strict-mode write to raise.
Sourcepub fn report(&self) -> Option<&WriteReport>
pub fn report(&self) -> Option<&WriteReport>
The report attached to this error, if any (only strict-mode format writers attach one).
Trait Implementations§
Source§impl Clone for WriteError
impl Clone for WriteError
Source§fn clone(&self) -> WriteError
fn clone(&self) -> WriteError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WriteError
impl Debug for WriteError
Source§impl Display for WriteError
impl Display for WriteError
impl Eq for WriteError
Source§impl Error for WriteError
impl Error for WriteError
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()
Source§impl From<DocumentError> for WriteError
impl From<DocumentError> for WriteError
Source§fn from(e: DocumentError) -> Self
fn from(e: DocumentError) -> Self
Source§impl From<WriteError> for OmnistError
impl From<WriteError> for OmnistError
Source§fn from(source: WriteError) -> Self
fn from(source: WriteError) -> Self
Source§impl PartialEq for WriteError
impl PartialEq for WriteError
impl StructuralPartialEq for WriteError
Auto Trait Implementations§
impl Freeze for WriteError
impl RefUnwindSafe for WriteError
impl Send for WriteError
impl Sync for WriteError
impl Unpin for WriteError
impl UnsafeUnpin for WriteError
impl UnwindSafe for WriteError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.