outlook-mapi
This crate implements Rust bindings for the Outlook MAPI COM APIs. The bindings are generated by the Windows crate in outlook-mapi-sys.
Getting Started
Include a reference to outlook-mapi in your Cargo.toml:
[]
= "0.8.0"
See the docs for more details.
Safety
Most of the bindings are re-exported transparently from outlook-mapi-sys as the outlook-mapi::sys module, and they are still marked unsafe. Unlike typical idiomatic Rust crates wrapped around a -sys crate, the emphasis of this crate is on writing as little manual wrapper code as possible. This way, outlook-mapi can project 100% of the Outlook MAPI COM API, but the downside is you will need to wrap most uses in an unsafe block or function.
Convenience Types
This crate does add several Rust structs and macro definitions to make it easier to work with MAPI types, and to add some lifetime guarantees when used in place of the raw MAPI API. For instance, the typical sequence of MAPI calls in C++ looks something like this:
;
;
// Do stuff with the session...
;
The convenience types ensure that you have a matching pair of MAPIInitialize and MAPIUninitialize calls, and they live at least as long as the session is in use. They also constrain which flags you can pass to each of these calls:
println!;
let initialized = new.expect;
println!;
let logon = new
.expect;
println!;
Windows Metadata
The Windows crate requires a Windows Metadata (winmd) file describing the API. The one used in this crate was generated with the mapi-win32md project. This crate needs it to use the #[implement] macro from the Windows crate.