Skip to main content

zlink_core/varlink_service/
mod.rs

1//! Types for the `org.varlink.service` interface.
2//!
3//! This module provides types for methods and errors to be used for both client and server
4//! implementations of the standard Varlink service interface.
5
6mod info;
7pub use info::{Info, OwnedInfo};
8mod api;
9pub use api::{Error, Method, OwnedError, OwnedReply, Reply, Result};
10
11#[cfg(all(feature = "idl-parse", feature = "std"))]
12mod proxy;
13#[cfg(all(feature = "idl-parse", feature = "std"))]
14pub use proxy::{Chain, Proxy};
15
16#[cfg(feature = "idl")]
17mod interface_description;
18#[cfg(feature = "idl")]
19pub use interface_description::InterfaceDescription;
20
21/// The name of the `org.varlink.service` interface.
22pub const INTERFACE_NAME: &str = "org.varlink.service";
23
24/// The description of the `org.varlink.service` interface.
25#[cfg(feature = "introspection")]
26pub const DESCRIPTION: &crate::idl::Interface<'static> = &{
27    use crate::{
28        idl::{Comment, Interface, Method, Parameter},
29        introspect::{ReplyError, Type},
30    };
31
32    const INTERFACE_PARAM: &Parameter<'static> = &Parameter::new("interface", <&str>::TYPE, &[]);
33    const METHODS: &[&Method<'static>] = &[
34        &Method::new(
35            "GetInfo",
36            &[],
37            Info::TYPE.as_object().unwrap().as_borrowed().unwrap(),
38            &[&Comment::new(
39                "Get basic information about the Varlink service",
40            )],
41        ),
42        &Method::new(
43            "GetInterfaceDescription",
44            &[INTERFACE_PARAM],
45            InterfaceDescription::TYPE
46                .as_object()
47                .unwrap()
48                .as_borrowed()
49                .unwrap(),
50            &[&Comment::new("Get the description of an interface")],
51        ),
52    ];
53
54    Interface::new(
55        INTERFACE_NAME,
56        METHODS,
57        &[],
58        Error::VARIANTS,
59        &[&Comment::new("Varlink service interface")],
60    )
61};