1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
45//! This crate contains a type-safe interface to the OpenThread API.
6//!
7//! This crate assumes that the OpenThread platform interface have been
8//! provided externally, perhaps by a separate crate.
910#![warn(missing_docs)]
11#![warn(missing_debug_implementations)]
12#![warn(rust_2018_idioms)]
1314pub mod ot;
15pub use openthread_sys as otsys;
1617#[cfg(target_os = "fuchsia")]
18mod otfuchsia;
1920/// Shorthand for `ot::Box<T>`
21pub type OtBox<T> = ot::Box<T>;
2223/// Shorthand for `ot::Box<ot::Instance>`.
24pub type OtInstanceBox = ot::Box<ot::Instance>;
2526/// Shorthand for `ot::Box<ot::Message<'a>>`.
27pub type OtMessageBox<'a> = ot::Box<ot::Message<'a>>;
2829/// Prelude namespace for improving the ergonomics of using this crate.
30#[macro_use]
31pub mod prelude {
32#![allow(unused_imports)]
3334pub use crate::{ot, otsys, OtBox, OtInstanceBox, OtMessageBox};
35pub use ot::{
36 BackboneRouter as _, BorderRouter as _, Boxable as _, Dnssd as _, DnssdExt as _,
37 IntoOtError as _, Ip6 as _, Link as _, MessageBuffer as _, OtCastable as _, Reset as _,
38 SrpServer as _, State as _, Tasklets as _, Thread as _, Udp as _, Uptime as _,
39 };
4041pub use ot::TaskletsStreamExt as _;
42pub use std::convert::{TryFrom as _, TryInto as _};
43}
4445// Internal prelude namespace for internal crate use only.
46#[doc(hidden)]
47#[macro_use]
48pub(crate) mod prelude_internal {
49#![allow(unused_imports)]
5051pub use crate::impl_ot_castable;
52pub use crate::otsys::*;
53pub use crate::prelude::*;
54pub use core::convert::{TryFrom, TryInto};
55pub use futures::prelude::*;
56pub use log::{debug, error, info, trace, warn};
57pub use num::FromPrimitive as _;
58pub(crate) use ot::ascii_dump;
59pub use ot::types::*;
60pub use ot::{
61 BackboneRouter, BorderRouter, Boxable, Error, Instance, InstanceInterface, Ip6, Link,
62 Message, MessageBuffer, Platform, Result, SrpServer, Tasklets, Thread,
63 };
64pub use static_assertions as sa;
65pub use std::ffi::{CStr, CString};
66pub use std::marker::PhantomData;
67pub use std::os::raw::c_char;
68pub use std::ptr::null;
69}