Skip to main content

FsWorkspace

Struct FsWorkspace 

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

A Workspace backed by a directory on disk.

This is the implementation used by the lintian-brush CLI. The CLI’s fixer harness materialises the working tree to disk before invoking a fixer; this workspace then operates on that directory, and breezyshim picks up the resulting changes outside the fixer.

It contains no breezyshim types and so is safe to depend on from hosts that don’t want a Python runtime.

Implementations§

Source§

impl FsWorkspace

Source

pub fn new( base_path: impl Into<PathBuf>, package: Option<String>, version: Option<Version>, ) -> Self

Create a new tree-backed workspace.

  • base_path — absolute filesystem path of the package root (the directory containing debian/).
  • package, version — taken from debian/changelog by the caller. Pass None when the caller hasn’t read the changelog (e.g. tests, or tools that don’t surface package metadata to their detectors).
Source

pub fn base_path(&self) -> &Path

The absolute on-disk root of the package.

Trait Implementations§

Source§

impl Workspace for FsWorkspace

Source§

fn package(&self) -> Option<&str>

The source package name, as read from debian/changelog. Read more
Source§

fn current_version(&self) -> Option<&Version>

The current version of the package, as read from debian/changelog. Read more
Source§

fn parsed_control(&self) -> Result<Control, Error>

Read debian/control and return a parsed value. Read more
Source§

fn parsed_changelog(&self) -> Result<ChangeLog, Error>

Read debian/changelog and return a parsed value. Read more
Read debian/copyright and return a parsed value. Read more
Source§

fn parsed_upstream_metadata(&self) -> Result<YamlFile, Error>

Read debian/upstream/metadata and return its parsed YAML. Read more
Source§

fn parsed_watch(&self) -> Result<ParsedWatchFile, Error>

Read debian/watch and return a parsed value. Read more
Source§

fn parsed_rules(&self) -> Result<Makefile, Error>

Read debian/rules and return the parsed Makefile. Read more
Source§

fn source_format(&self) -> Result<Option<String>, Error>

Read the trimmed contents of debian/source/format. Read more
Source§

fn control(&self) -> Result<Box<dyn Editor<Control> + '_>, Error>

Open debian/control for editing. Read more
Source§

fn changelog(&self) -> Result<Box<dyn Editor<ChangeLog> + '_>, Error>

Open debian/changelog for editing. See control.
Source§

fn debcargo(&self) -> Result<Option<Box<dyn Editor<DocumentMut> + '_>>, Error>

Open debian/debcargo.toml for editing. Read more
Source§

fn read_file(&self, rel: &Path) -> Result<Option<Cow<'_, [u8]>>, Error>

Read raw bytes of an arbitrary file relative to the package root. Read more
Source§

fn write_file(&self, rel: &Path, content: &[u8]) -> Result<(), Error>

Write raw bytes to an arbitrary file relative to the package root. Read more
Source§

fn list_dir(&self, rel: &Path) -> Result<Option<Vec<String>>, Error>

List the entries of a directory relative to the package root. Read more
Source§

fn walk_dir(&self, rel: &Path) -> Result<Option<Vec<PathBuf>>, Error>

Recursively walk rel, returning the relative paths of every regular file beneath it (paths are relative to the package root, not to rel). Read more
Source§

fn file_mode(&self, rel: &Path) -> Result<Option<u32>, Error>

Read the Unix file mode of rel, or None if the file is missing. Read more
Source§

fn base_path(&self) -> Option<&Path>

On-disk root for hosts that have one. Read more
Source§

fn parsed_debcargo(&self) -> Result<Option<DocumentMut>, Error>

Read debian/debcargo.toml and return a parsed TOML document. 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> 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
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> 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
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,