Auto convert one error to another
Automatically convert one error to another.
[Read More]Display Trait
Define a display trait for a struct or enum
impl std::fmt::Display for MechanismError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
MechanismError::NotValidMechanismFormat(mesg) => {
write!(f, "{} does not conform to any Mechanism format.", mesg)
}
MechanismError::NotIP4Network(mesg) => {
write!(f, "Was given ip4:{}. This is not an ip4 network.", mesg)
}
MechanismError::NotIP6Network(mesg) => {
write!(f, "Was given ip6:{}. This is not an ip6 network.", mesg)
}
MechanismError::NotValidIPNetwork(mesg) => {
write!(f, "{}.", mesg)
}
MechanismError::NotIpNetworkMechanism => {
write!(f, "Attempt to access TXT as IP.")
}
MechanismError::NotStringMechanism => {
write!(f, "Attempt to access IP as TXT.")
}
}
}
}
Reference:
Enum to Encapulate Errors
Creating a enum to encapsulate Errors.
[Read More]Using trust-dns-resolver to do mx lookups
Using trust-dns-resolver to do soa lookups
Decon-Spf Version 0.2.1 Released
I am happy to announce that I have released decon-spf version 0.2.1 This release contains a number of improvements and a new feature.
[Read More]Published My First Crate: decon-spf
Today I published my first rust crate.
[Read More]Rust: Add an Example Program to your Library Crate
Recently I decided that I might actually publish my little rust crate. To that end I started looking into some of the things that are needed and what can be done. I have published a perl module in the past. And as a rule for myself, I like to provide an example program that uses a module or library. That is what I will look at today.
[Read More]Rust: Lazy Static Regex
Passing Regex around, helping the compiler keep things optimised.
Hi,
Today I will finally go over how I used the lazy_static crate to help the compiler keep regex optimised.
[Read More]