Skip to main content

ViewService

Struct ViewService 

Source
pub struct ViewService<'a, P: ProjectDirectory + ?Sized> { /* private fields */ }
Expand description

The saved-view service: the registry, the caller’s config, and the project directory the scope checks resolve against.

The service borrows the caller’s Config mutably because an accepted mutation is config.views changing; it never reaches around the registry to write anything else. The active marker is in-memory state beside the config — data-model §4’s “if explicitly persisted” — so marking a view writes no file.

Implementations§

Source§

impl<'a, P: ProjectDirectory + ?Sized> ViewService<'a, P>

Source

pub fn new(config: &'a mut Config, projects: &'a P, path: &'a Path) -> Self

A service over a caller’s config, project directory, and tix.toml path.

Source

pub fn registry(&self) -> &ViewRegistry

The registry, for a surface that needs to enumerate or render it directly.

Source

pub fn list(&self) -> Vec<SavedView>

Every stored view, in declaration order (T013).

Source

pub fn show(&self, reference: &str) -> ViewResult<ViewDetail>

Resolve one view by stable id or display name, parse and validate its plan, and return it with any unknown-metadata diagnostics (T013).

A malformed plan is refused here, before a caller could try to apply or re-save it: “show” is the first place a stored-but-unsupported field would otherwise slip through.

Source

pub fn apply( &self, reference: &str, board: &BoardConfiguration, corpus: &Corpus, resolution: &CategoryResolution, ) -> ViewResult<ViewApplyResult>

Apply a saved view: resolve it, then build the board once through the existing filter path (T015/C-005).

Read-only: board, corpus, and config are borrowed, and the result owns only derived copies. Nothing is written, and a refused or unsupported plan produces no board.

Source

pub fn active(&self) -> Option<&ActiveViewMarker>

The active marker, when a view has been selected.

Source

pub fn mark_active( &mut self, reference: &str, source: Option<ViewSurface>, ) -> ViewResult<()>

Select a saved view as the active marker (T016).

The plan is parsed and validated first, so an unsupported definition cannot be marked. Selecting is informational and idempotent: it writes no config and does not touch live filters, and selecting the same view twice leaves an equal marker (C-006).

Source

pub fn set_active(&mut self, marker: ActiveViewMarker)

Install a marker directly, for a surface restoring one it persisted.

Still informational: this writes nothing, and a marker whose view has since been deleted is reported (not repaired) by Self::divergence.

Source

pub fn clear_active(&mut self)

Clear the active marker. Informational, writes nothing.

Source

pub fn divergence(&self, live: &ViewPlan) -> ViewDivergence

Compare the live plan against the active view’s saved definition (T016).

Never mutates anything. A missing marker, a deleted view, or an uninterpretable saved plan is an explicit diagnostic rather than a in_sync = true.

Source

pub fn create(&mut self, definition: ViewDefinition) -> ViewMutation<ViewId>

Create a definition under a freshly allocated stable id (T013).

The complete definition is validated — name, scope, and every plan field — before the candidate registry is committed, so a rejected create writes nothing.

Source

pub fn update( &mut self, reference: &str, definition: ViewDefinition, ) -> ViewMutation<ViewId>

Replace an existing definition’s name, scope, and plan in place (T013).

The stable id never changes (identity survives a rename, C-002) and the record’s preserved extension fields are left untouched (NFR-002). A same-content update is a no-op: no commit, no audit event.

Source

pub fn duplicate( &mut self, reference: &str, name: Option<&str>, ) -> ViewMutation<ViewId>

Duplicate a definition under a new stable id (T013).

The copy carries the source’s scope, plan, and preserved extensions verbatim; only the id is new. name overrides the label when given.

Source

pub fn delete( &mut self, reference: &str, _confirmation: DeleteConfirmed, ) -> ViewMutation<DeletedView>

Delete a view definition after explicit confirmation (T014/C-005).

Only the definition is removed; issues, comments, relationships, and board data are never touched. If the active marker named this view it is cleared, and the outcome reports that so the caller can surface it. Deleting an unknown reference is refused (nothing was stored to remove).

Auto Trait Implementations§

§

impl<'a, P> !UnwindSafe for ViewService<'a, P>

§

impl<'a, P> Freeze for ViewService<'a, P>
where &'a P: Freeze, P: ?Sized,

§

impl<'a, P> RefUnwindSafe for ViewService<'a, P>

§

impl<'a, P> Send for ViewService<'a, P>
where &'a P: Send, P: ?Sized,

§

impl<'a, P> Sync for ViewService<'a, P>
where &'a P: Sync, P: ?Sized,

§

impl<'a, P> Unpin for ViewService<'a, P>
where &'a P: Unpin, P: ?Sized,

§

impl<'a, P> UnsafeUnpin for ViewService<'a, P>
where &'a P: UnsafeUnpin, P: ?Sized,

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.