Skip to main content

zlink_core/
lib.rs

1#![cfg_attr(not(any(feature = "std", test)), no_std)]
2#![doc(
3    html_logo_url = "https://raw.githubusercontent.com/z-galaxy/zlink/3660d731d7de8f60c8d82e122b3ece15617185e4/data/logo.png"
4)]
5#![deny(
6    missing_debug_implementations,
7    nonstandard_style,
8    rust_2018_idioms,
9    missing_docs
10)]
11#![warn(unreachable_pub, clippy::std_instead_of_core)]
12#![cfg_attr(not(doctest), doc = include_str!("../README.md"))]
13
14#[cfg(not(any(feature = "tracing", feature = "defmt")))]
15compile_error!("Either 'tracing' or 'defmt' feature must be enabled.");
16
17#[cfg(doctest)]
18mod doctests {
19    // Book markdown checks. The other chapters are checked from the `zlink` crate; this one is
20    // checked from here because its transport example implements the `no_std` variants of the
21    // socket traits, whose signatures differ when the `std` feature is enabled.
22    #[cfg(not(feature = "std"))]
23    doc_comment::doctest!("../../book/src/embedded.md");
24}
25
26extern crate alloc;
27
28#[macro_use]
29#[doc(hidden)]
30pub mod log;
31
32mod json_ser;
33
34pub mod connection;
35pub use connection::Connection;
36mod error;
37pub use error::{Error, Result};
38#[cfg(feature = "server")]
39mod server;
40#[cfg(feature = "server")]
41pub use server::{
42    Server,
43    listener::{Listener, ReadyListener},
44    service::{self, Service},
45};
46mod call;
47#[cfg(feature = "server")]
48pub mod notified;
49pub use call::Call;
50pub mod reply;
51pub use reply::Reply;
52#[cfg(feature = "idl")]
53pub mod idl {
54    //! Interface Definition Language (IDL) support for Varlink.
55    //!
56    //! This is a re-export of the [`zlink_idl`] crate, for those who only need the IDL API and not
57    //! the rest of zlink.
58
59    #[doc(inline)]
60    pub use zlink_idl::*;
61}
62#[cfg(feature = "introspection")]
63pub mod introspect;
64pub mod varlink_service;
65
66#[cfg(feature = "proxy")]
67pub use zlink_macros::proxy;
68
69#[cfg(feature = "service")]
70pub use zlink_macros::service;
71
72/// Re-export of futures-util for use in generated code.
73#[doc(hidden)]
74pub use futures_util;
75
76/// Re-export of pin-project-lite for use in generated service code.
77#[cfg(feature = "service")]
78#[doc(hidden)]
79pub use pin_project_lite;
80
81pub use zlink_macros::ReplyError;
82
83#[cfg(feature = "std")]
84#[doc(hidden)]
85pub mod unix_utils;
86
87#[doc(hidden)]
88pub mod test_utils;