Skip to main content

ViewScope

Struct ViewScope 

Source
pub struct ViewScope {
    pub kind: ViewScopeKind,
    pub project_id: Option<String>,
    pub owner: Option<String>,
    pub shared_with: Vec<String>,
    pub extensions: Table,
}
Expand description

Explicit sharing/visibility metadata (data-model §2).

Every optional field is omitted from tix.toml when it is empty, so a repository view is two lines and a project view names exactly one project. Unknown keys are preserved in ViewScope::extensions rather than rejected: a newer tix may have written a scope field this build does not know, and dropping it would be the metadata loss the mission forbids (NFR-002).

Fields§

§kind: ViewScopeKind

Which scope family this is.

§project_id: Option<String>

The project this view belongs to; required for ViewScopeKind::Project.

§owner: Option<String>

The identity a user/share scope belongs to. A label, not an account.

§shared_with: Vec<String>

Identities a user/share scope is shared with. Labels, not grants.

§extensions: Table

Scope keys this build does not interpret, preserved verbatim.

Implementations§

Source§

impl ViewScope

Source

pub fn repository() -> Self

A repository-wide scope: no sharing metadata at all.

Source

pub fn project(project_id: impl Into<String>) -> Self

A project scope. The id is not resolved here — that needs the project registry, and ViewScope::conflicts is the structural check.

Source

pub fn user_share(owner: Option<String>, shared_with: Vec<String>) -> Self

A user/share scope. owner and shared_with are metadata only.

Source

pub fn conflicts(&self) -> Vec<ViewDiagnostic>

The structural problems with this scope, independent of any project registry. Empty when the scope is internally consistent.

These are the rules a record cannot break and be meaningful under: a project scope with no project, a repository scope that names one, share metadata on a scope that is not a share, and blank or repeated identities.

Source

pub fn resolution<P: ProjectDirectory + ?Sized>( &self, projects: &P, ) -> ScopeResolution

Resolve this scope against the project registry (data-model §2).

Trait Implementations§

Source§

impl Clone for ViewScope

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ViewScope

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ViewScope

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ViewScope

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ViewScope

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ViewScope

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ViewScope

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> CloneToUninit for T
where T: Clone,

Source§

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

Uses borrowed data to replace owned data, usually by cloning. 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.