Trait Publish

Source
pub trait Publish<R>: Sealed {
    type Error;
    type Id;

    // Required methods
    fn publish<C>(
        &self,
        paths: C,
        remotes: HashMap<Label, (Version, Self::Id)>,
    ) -> Vec<Result<Result<Record<R>, Label>, Self::Error>>
       where C: IntoIterator<Item = PathBuf>;
    fn publish_atom<P: AsRef<Path>>(
        &self,
        path: P,
        remotes: &HashMap<Label, (Version, Self::Id)>,
    ) -> Result<Result<Record<R>, Label>, Self::Error>;
}
Expand description

The primary trait for exposing atom publishing logic for a given store.

Required Associated Types§

Source

type Error

The error type returned by the publisher.

Source

type Id

The type representing the machine-readable identity for a specific version of an atom.

Required Methods§

Source

fn publish<C>( &self, paths: C, remotes: HashMap<Label, (Version, Self::Id)>, ) -> Vec<Result<Result<Record<R>, Label>, Self::Error>>
where C: IntoIterator<Item = PathBuf>,

Publishes a collection of atoms.

This function processes a collection of paths, each representing an atom to be published, by calling Publish::publish_atom for each path.

§Error Handling

The function processes all provided paths, even if some fail. Errors and skipped atoms are collected as results but do not halt the overall process.

§Return Value

Returns a vector of results. The outer Result represents a failure to publish an atom, while the inner Result (PublishOutcome) indicates whether an atom was published or safely skipped because it already exists.

Source

fn publish_atom<P: AsRef<Path>>( &self, path: P, remotes: &HashMap<Label, (Version, Self::Id)>, ) -> Result<Result<Record<R>, Label>, Self::Error>

Publishes a single atom.

This function takes a single path and publishes the atom located there.

§Return Value
  • An Ok variant containing a PublishOutcome, which is either the Record<R> of the successfully published atom or the Label if it was safely skipped.
  • An Err variant containing a Self::Error if the atom could not be published for any reason (e.g., an invalid manifest).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> Publish<Root> for GitContext<'a>

Source§

type Error = Error

Source§

type Id = ObjectId