Skip to main content

DraftReason

Enum DraftReason 

Source
pub enum DraftReason {
    AwaitingRelease {
        awaiting: String,
        target: TargetName,
        reference: String,
        because: String,
    },
    Held {
        because: String,
    },
}
Expand description

Why a change request is a draft, in the shape a machine reads it.

A draft is a change request that must not land yet, and there are two reasons one is held. A change that has gone as far as it can and stopped short of the one step that would make something temporary permanent — a dependency pinned to a branch rather than to a release — is AwaitingRelease, and what it is waiting for is the whole of the reason: which repository, which of that repository’s release targets, and the reference the change is pinned to in the meantime. A change whose work is still being made — evidence gathered, a description started — is Held by the session that opened it, and the one line a person reads is the whole of that reason. The kind tag is what a consumer routes on; because is the same fact as a sentence, for whoever reads it rather than routes on it.

It is recorded on the session’s own event stream — the publication record — and nowhere else. Nothing is written into the change request’s body, under a marker heading or anywhere: a body is prose a reviewer reads and a drafting caller may rewrite, and deciding a control action from it would turn an editorial act into one. The cost of that is carried openly: somebody looking at the draft change request without access to this host sees that it is a draft and not why.

Variants§

§

AwaitingRelease

A change pinned to a dependency’s branch until that dependency releases — what a fast-adoption publication carries.

Fields

§awaiting: String

The repository identity whose release is awaited, as the registry keys one.

A String rather than a newtype because an identity key is one everywhere this crate spells one — Identity::origin, Recoverable::identity, the registry document’s own map key — so a narrower type here would disagree with every type it is compared against. What must not be representable is a value that renders as something other than itself in a refusal or an event payload, and checked refuses exactly that at every boundary one arrives at.

§target: TargetName

Which release target of it is awaited.

§reference: String

The reference this change is pinned to until that release arrives — the branch of the awaited repository the pin names.

A String for the reason awaiting above is, and one more of its own: this is the awaited repository’s branch name rather than one this repository’s git could be asked about, so the parser that would decide it is not this host’s. checked refuses the values that would render as something else.

§because: String

One line a person reads, saying why the change is not ready.

Prose, so there is nothing for a type to narrow. The one shape that matters is where it lands — a single rendered line — and checked is what holds it to that.

§

Held

A change request the session that opened it is holding open as a draft while its work is still being made: evidence gathered, description started. Lifted by onevcs change ready, or taken by a later publication of the same session carrying no reason into the draft lifecycle — which keeps it a draft when green on a change-open identity whose approvals are required.

Fields

§because: String

One line a person reads, saying why the session is holding it. Prose, held to the one line it is printed on by checked, as the line above is.

Implementations§

Source§

impl DraftReason

Source

pub fn checked(&self) -> Result<()>

The rule a publication holds a reason to, or the refusal that this is not one.

Every field here is printed: into a refusal, into an event payload a consumer reads back, and — through --draft — at a host. So the check is the one that decides whether a value renders as itself: nothing empty, and nothing carrying a control character, which is what turns one line of a record into two.

Public for the reason MergePolicy::narrow and FailureKind::of are: it belongs to publication rather than to any one implementation of it, so a supplied Vcs applies this rule at its own boundary rather than a restatement of it that could accept what the real one refuses. It is a method rather than a conversion because the contract fixes the fields as public and settable, so there is no constructor for a check to live in.

§Errors

Error::Invalid naming the field that would not render as itself.

Trait Implementations§

Source§

impl Clone for DraftReason

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 DraftReason

Source§

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

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

impl<'de> Deserialize<'de> for DraftReason

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 Eq for DraftReason

Source§

impl PartialEq for DraftReason

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 DraftReason

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 DraftReason

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

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