FsEditor

Struct FsEditor 

Source
pub struct FsEditor<P: Marshallable> { /* private fields */ }
Expand description

An editor for a file

Implementations§

Source§

impl<P: Marshallable> FsEditor<P>

Source

pub fn from_env( path: &Path, allow_generated: bool, allow_reformatting: Option<bool>, ) -> Result<Self, EditorError>

Create a new editor, with preferences being read from the environment

Source

pub fn new( path: &Path, allow_generated: bool, allow_reformatting: bool, ) -> Result<Self, EditorError>

Create a new editor

Trait Implementations§

Source§

impl<M: Marshallable> DerefMut for FsEditor<M>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<P: Marshallable> Editor<P> for FsEditor<P>

Source§

fn orig_content(&self) -> Option<&[u8]>

The original content, if any - without reformatting
Source§

fn updated_content(&self) -> Option<Vec<u8>>

The updated content, if any
Source§

fn rewritten_content(&self) -> Option<&[u8]>

The original content, but rewritten with our parser/serializer
Source§

fn is_generated(&self) -> bool

Check if the file is generated
Source§

fn commit(&self) -> Result<Vec<PathBuf>, EditorError>

Commit the changes Read more
Source§

fn has_changed(&self) -> bool

Whether the file has changed
Source§

impl<M: Marshallable> Deref for FsEditor<M>

Source§

type Target = M

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<P> Freeze for FsEditor<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for FsEditor<P>
where P: RefUnwindSafe,

§

impl<P> Send for FsEditor<P>
where P: Send,

§

impl<P> Sync for FsEditor<P>
where P: Sync,

§

impl<P> Unpin for FsEditor<P>
where P: Unpin,

§

impl<P> UnwindSafe for FsEditor<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<E> AbstractControlEditor for E
where E: Editor<Control>,

Source§

fn source<'a>(&'a mut self) -> Option<Box<dyn AbstractSource<'a> + 'a>>

Get the source package.
Source§

fn binaries<'a>(&'a mut self) -> Vec<Box<dyn AbstractBinary + 'a>>

Get the binary packages.
Source§

fn commit(&self) -> bool

Commit the changes.
Source§

fn wrap_and_sort(&mut self)

Wrap and sort the control file.
§

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> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Ungil for T
where T: Send,