#[non_exhaustive]pub enum Error {
UnsupportedValue(&'static str),
Serialize(String),
Ipv6InIpv4Tree(Ipv6Net),
InvalidRange(&'static str),
AliasedNetwork(IpNet),
ReservedNetwork(IpNet),
TreeTooLarge {
node_count: usize,
max: u64,
record_size: RecordSize,
},
Io(Error),
Load(String),
}Expand description
Errors returned while building or writing a database.
This type implements std::error::Error and is Send + Sync + 'static, so it composes
with Box<dyn Error> and error libraries such as anyhow.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnsupportedValue(&'static str)
A value could not be represented in MMDB’s type system.
The most common cause is an i64/isize field (MMDB has no signed 64-bit type), a
non-string map key, or a top-level Option::None.
Serialize(String)
A serde::Serialize value failed to serialize.
Ipv6InIpv4Tree(Ipv6Net)
An IPv6 network was inserted into an IPv4-only (ip_version = 4) database.
InvalidRange(&'static str)
A range passed to Writer::insert_range was invalid —
the endpoints are different IP families, or the start is above the end.
AliasedNetwork(IpNet)
An insert targeted a network reserved for IPv4 aliasing
(::ffff:0:0/96, 2001::/32, or 2002::/16).
ReservedNetwork(IpNet)
An insert targeted a reserved network while reserved networks were excluded (the
default). Enable ReservedNetworks::Included to write into reserved space.
TreeTooLarge
The tree (plus data section) grew past what the chosen RecordSize can address.
When the record size is chosen automatically this cannot happen below the 32-bit ceiling; it only surfaces when a smaller size was pinned explicitly, or for a genuinely enormous database.
Fields
record_size: RecordSizeThe record size that was too small.
Io(Error)
Writing to the destination std::io::Write failed.
Load(String)
Reading an existing database with Writer::load failed.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()