TevClient

Struct TevClient 

Source
pub struct TevClient { /* private fields */ }
Expand description

A connection to a Tev instance. Constructed using TevClient::wrap, TevClient::spawn or TevClient::spawn_path_default. Use TevClient::send to send commands.

Implementations§

Source§

impl TevClient

Source

pub fn wrap(socket: TcpStream) -> Self

Create a TevClient from an existing TcpStream that’s connected to tev. If tev may not be running yet use TevClient::spawn or TevClient::spawn_path_default instead.

For example, if tev is already running on the default hostname:

let mut client = TevClient::wrap(TcpStream::connect("127.0.0.1:14158")?);
Source

pub fn spawn_path_default() -> Result<TevClient, TevError>

Create a new TevClient by spawning tev assuming it is in PATH with the default hostname.

Source

pub fn spawn(command: Command) -> Result<TevClient, TevError>

Crate a TevClient from a command that spawns tev. If tev is in PATH and the default hostname should be used use TevClient::spawn_path_default instead.

let mut command = Command::new("path/to/tev");
command.arg("--hostname=127.0.0.1:14159");
let mut client = TevClient::spawn(command)?;
Source

pub fn send(&mut self, packet: impl TevPacket) -> Result<()>

Send a command to tev. A command is any struct in this crate that implements [TevPacket].

§Example
client.send(PacketCloseImage { image_name: "test.exf" })?;

Trait Implementations§

Source§

impl Debug for TevClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.