pub struct Spec<'repo> { /* private fields */ }
Expand description

The specification of a revision as parsed from a revision specification like HEAD@{1} or v1.2.3...main. It’s typically created by repo.rev_parse().

See the official git documentation for reference on how to specify revisions and revision ranges.

Implementations§

Parse spec and use information from repo to resolve it, using opts to learn how to deal with ambiguity.

Note that it’s easier and to use repo.rev_parse() instead.

Initialization

Create a single specification which points to id.

Access

Detach the Repository from this instance, leaving only plain data that can be moved freely and serialized.

Some revision specifications leave information about references which are returned as (from-ref, to-ref) here, e.g. HEAD@{-1}..main might be (Some(refs/heads/previous-branch), Some(refs/heads/main)), or @ returns (Some(refs/heads/main), None).

Return the name of the first reference we encountered while resolving the rev-spec, or None if a short hash was used. For example, @ might yield Some(HEAD), but abcd yields None.

Return the name of the second reference we encountered while resolving the rev-spec, or None if a short hash was used or there was no second reference. For example, ..@ might yield Some(HEAD), but ..abcd or @ yields None.

Return the single included object represented by this instance, or None if it is a range of any kind.

Methods from Deref<Target = Spec>§

Return the kind of this specification.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Checks if this value is equivalent to the given key. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.