Client

Struct Client 

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

A simple 9p client for ad

Implementations§

Source§

impl Client

Source

pub fn new() -> Result<Self>

Create a new client connected to ad over it’s 9p unix socket

Source

pub fn new_for_pid(pid: &str) -> Result<Self>

Create a new client connected to the ad session with the given pid over it’s 9p unix socket.

When running under ad, the Client::new method will automatically find and connect to it’s parent session.

Source

pub fn log_events( &mut self, ) -> Result<impl Iterator<Item = Result<LogEvent>> + use<>>

Iterate over the log events emitted by ad

Source

pub fn current_buffer(&mut self) -> Result<String>

Get the currently active buffer id.

Source

pub fn read_dot(&mut self, buffer: &str) -> Result<String>

Read the contents of the dot of the given buffer

Source

pub fn read_body(&mut self, buffer: &str) -> Result<String>

Read the body of the given buffer.

Source

pub fn read_addr(&mut self, buffer: &str) -> Result<String>

Read the current dot address of the given buffer.

Source

pub fn read_filename(&mut self, buffer: &str) -> Result<String>

Read the filename of the given buffer

Source

pub fn read_xaddr(&mut self, buffer: &str) -> Result<String>

Read the x-address of the given buffer.

This is only used by the filesystem interface of ad and will not affect the current editor state.

Source

pub fn read_xdot(&mut self, buffer: &str) -> Result<String>

Read the x-dot of the given buffer.

This is only used by the filesystem interface of ad and will not affect the current editor state.

Source

pub fn write_dot(&mut self, buffer: &str, content: &str) -> Result<usize>

Replace the dot of the given buffer with the provided string.

Source

pub fn append_to_body(&mut self, buffer: &str, content: &str) -> Result<usize>

Append the provided string to the given buffer.

Source

pub fn write_addr(&mut self, buffer: &str, addr: &str) -> Result<usize>

Set the addr of the given buffer.

Source

pub fn write_xdot(&mut self, buffer: &str, content: &str) -> Result<usize>

Replace the xdot of the given buffer with the provided string.

Source

pub fn write_xaddr(&mut self, buffer: &str, content: &str) -> Result<usize>

Set the xaddr of the given buffer.

Source

pub fn ctl(&mut self, command: &str, args: &str) -> Result<()>

Send a control message to ad.

Source

pub fn echo(&mut self, msg: impl AsRef<str>) -> Result<()>

Echo a string message in the status line.

Source

pub fn open(&mut self, path: impl AsRef<str>) -> Result<()>

Open the requested file.

Source

pub fn open_in_new_window(&mut self, path: impl AsRef<str>) -> Result<()>

Open the requested file in a new window.

Source

pub fn reload_current_buffer(&mut self) -> Result<()>

Reload the currently active buffer.

Source

pub fn run_event_filter<F>(&mut self, buffer: &str, filter: F) -> Result<()>
where F: EventFilter,

Run a provided EventFilter until it exits or errors

Source

pub fn body_writer(&self, bufid: &str) -> Result<BodyWriter>

Create a Write impl that can be used to continuously write to the given path

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where 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>

Performs the conversion.