Struct scrawl::editor::Editor

source ·
pub struct Editor<S: EditorState> { /* private fields */ }
Expand description

This is the struct that allows the caller to customize which editor is called, what it is seeded with, and more.

Implementations§

source§

impl Editor<DefaultState>

source

pub fn ext<S: AsRef<str>>(&mut self, ext: S) -> &mut Self

Specify which extension should be used on the temporary file (often used by text editors to infer syntax highlighting).

source

pub fn editor<S: AsRef<OsStr>>(self, editor: S) -> Editor<SpecificEditorState>

Specify which editor should be opened instead of the user’s default.

source

pub fn open(&mut self, contents: Contents<'_>) -> Result<Reader, Box<dyn Error>>

Opens the user’s editor.

source

pub fn edit<P: AsRef<Path>>(&mut self, path: P) -> Result<Reader, Box<dyn Error>>

Opens a file for editing in the User’s editor.

source§

impl Editor<SpecificEditorState>

source

pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self

Add arguments that you want to be used when the command is run. The first argument is always the file being used as the buffer. Requires that a specific editor has been set.

source

pub fn ext<S: AsRef<str>>(&mut self, ext: S) -> &mut Self

Specify which extension should be used on the temporary file (often used by text editors to infer syntax highlighting).

source

pub fn open(&mut self, contents: Contents<'_>) -> Result<Reader, Box<dyn Error>>

Opens the user’s editor.

source

pub fn edit<P: AsRef<Path>>(&mut self, path: P) -> Result<Reader, Box<dyn Error>>

Opens a file for editing in the User’s editor.

Trait Implementations§

source§

impl<S: Debug + EditorState> Debug for Editor<S>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> RefUnwindSafe for Editor<S>where
    S: RefUnwindSafe,

§

impl<S> Send for Editor<S>where
    S: Send,

§

impl<S> Sync for Editor<S>where
    S: Sync,

§

impl<S> Unpin for Editor<S>where
    S: Unpin,

§

impl<S> UnwindSafe for Editor<S>where
    S: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.