/* -*- Mode: rust; rust-indent-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::fmt;
/// Helper macro to create an Error that knows which file and line it occurred /// on. Can optionally have some extra information as a String. #[macro_export]
macro_rules! error_here {
($error_type:expr) => {
Error::new($error_type, file!(), line!(), None)
};
($error_type:expr, $info:expr) => {
Error::new($error_type, file!(), line!(), Some($info))
};
}
/// Error type for identifying errors in this crate. Use the error_here! macro /// to instantiate. #[derive(Debug)] pubstruct Error {
typ: ErrorType,
file: &'static str,
line: u32,
info: Option<String>,
}
#[derive(Copy, Clone, Debug)] pubenum ErrorType { /// An error in an external library or resource.
ExternalError, /// Unexpected extra input (e.g. in an ASN.1 encoding).
ExtraInput, /// Invalid argument.
InvalidArgument, /// Invalid data input.
InvalidInput, /// An internal library failure (e.g. an expected invariant failed).
LibraryFailure, /// Truncated input (e.g. in an ASN.1 encoding).
TruncatedInput, /// Unsupported input.
UnsupportedInput, /// A given value could not be represented in the type used for it.
ValueTooLarge,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.