[−][src]Struct varlink::Connection
A client connection builder to a varlink service.
Fields
reader: Option<BufReader<Box<dyn Read + Send + Sync>>>
writer: Option<Box<dyn Write + Send + Sync>>
stream: Option<VarlinkStream>
child: Option<Child>
tempdir: Option<TempDir>
Methods
impl Connection
[src]
pub fn new<S: ?Sized + AsRef<str>>(address: &S) -> Result<Arc<RwLock<Self>>>
[src]
Create a connection with a varlink URI
see with_address
pub fn with_address<S: ?Sized + AsRef<str>>(
address: &S
) -> Result<Arc<RwLock<Self>>>
[src]
address: &S
) -> Result<Arc<RwLock<Self>>>
Create a connection with a varlink URI
following the varlink address specification.
Currently supported address URIs are:
- TCP
tcp:127.0.0.1:12345
hostname/IP address and port - UNIX socket
unix:/run/org.example.ftl
- UNIX abstract namespace socket
unix:@org.example.ftl
(on Linux only)
Examples
let connection = Connection::with_address("unix:/tmp/org.example.myservice"); let connection = Connection::with_address("tcp:127.0.0.1:12345");
pub fn with_activate<S: ?Sized + AsRef<str>>(
command: &S
) -> Result<Arc<RwLock<Self>>>
[src]
command: &S
) -> Result<Arc<RwLock<Self>>>
Create a connection to a service, which is executed in the background.
Create a connection to a service, which is started with command
and passed a socket pair
via socket activation. The address of the unix socket is set in the environment variable
VARLINK_ADDRESS
. Additionally the socket activation variables LISTEN_FDS=1
,
LISTEN_FDNAMES=varlink
and LISTEN_PID
are set.
Examples
let connection = Connection::with_activate("myservice --varlink=$VARLINK_ADDRESS");
pub fn with_bridge<S: ?Sized + AsRef<str>>(
command: &S
) -> Result<Arc<RwLock<Self>>>
[src]
command: &S
) -> Result<Arc<RwLock<Self>>>
Create a connection to a service via stdin/stdout of a specified command.
Create a "bridge" to e.g. another host via ssh
or other connection commands.
On the remote side varlink bridge
is typically started.
The connection will go through stdin/stdout of the command and the remote bridge command
will multiplex to the wanted varlink services.
Of course with ssh
there are better options, like unix socket
forwarding -L local_socket:remote_socket
.
Examples
let connection = Connection::with_bridge("ssh my.example.org -- varlink bridge");
pub fn address(&self) -> String
[src]
Return the address
used by the connection.
Only useful, if you want to clone a connection built with_activate or with_address
Trait Implementations
Auto Trait Implementations
impl Send for Connection
impl Sync for Connection
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> IntoChainError for T where
U: ChainErrorFrom<T>,
[src]
U: ChainErrorFrom<T>,
fn into_chain_error(
self,
line_filename: Option<(u32, &'static str)>
) -> ChainError<U>
[src]
self,
line_filename: Option<(u32, &'static str)>
) -> ChainError<U>