pub struct Reference<'r> {
    pub inner: Reference,
    /* private fields */
}
Expand description

A reference that points to an object or reference, with access to its source repository.

Note that these are snapshots and won’t recognize if they are stale.

Fields

inner: Reference

The actual reference data

Implementations

Remotes

Find the name of our remote for direction as configured in branch.<name>.remote|pushRemote respectively. If Some(<name>) it can be used in Repository::find_remote(…), or if None then Repository::remote_default_name() could be used in its place.

Return None if no remote is configured.

Note
  • it’s recommended to use the remote(…) method as it will configure the remote with additional information.
  • branch.<name>.pushRemote falls back to branch.<name>.remote.

Like remote_name(…), but configures the returned Remote with additional information like

  • branch.<name>.merge to know which branch on the remote side corresponds to this one for merging when pulling.

Return a platform for obtaining iterators over reference logs.

Set the id of this direct reference to id and use reflog_message for the reflog (if enabled in the repository).

Note that the operation will fail on symbolic references, to change their type use the lower level reference database, or if the reference was deleted or changed in the mean time. Furthermore, refrain from using this method for more than a one-off change as it creates a transaction for each invocation. If multiple reference should be changed, use Repository::edit_references() or the lower level reference database instead.

Delete this reference or fail if it was changed since last observed. Note that this instance remains available in memory but probably shouldn’t be used anymore.

Access

Returns the attached id we point to, or None if this is a symbolic ref.

Returns the attached id we point to, or panic if this is a symbolic ref.

Return the target to which this reference points to.

Return the reference’s full name.

Turn this instances into a stand-alone reference.

Follow all symbolic targets this reference might point to and peel the underlying object to the end of the chain, and return it.

This is useful to learn where this reference is ulitmately pointing to.

Similar to peel_to_id_in_place(), but consumes this instance.

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

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

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.