Skip to main content

SyncProvider

Trait SyncProvider 

Source
pub trait SyncProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn has_config(&self, manifest: &Base) -> bool;
    fn sync_path<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
        ctx: &'life2 SyncContext<'life3>,
    ) -> Pin<Box<dyn Future<Output = Result<SyncResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn sync_all<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 SyncContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<SyncResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for sync providers.

Each provider (ignore, cubes, codeowners, ci) implements this trait to handle synchronization of its specific file type.

§Implementors

  • cuenv-ignore: Generates .gitignore, .dockerignore, etc.
  • cuenv-codeowners: Generates CODEOWNERS files
  • cuenv-codegen: Generates files from CUE codegen templates
  • cuenv-ci: Generates CI workflow files

Required Methods§

Source

fn name(&self) -> &'static str

Name of the sync provider (e.g., “ignore”, “codegen”).

Used as the CLI subcommand name.

Source

fn description(&self) -> &'static str

Description for CLI help.

Source

fn has_config(&self, manifest: &Base) -> bool

Check if this provider has configuration for the given manifest.

Used to determine which providers to run when syncing all.

Source

fn sync_path<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, path: &'life1 Path, ctx: &'life2 SyncContext<'life3>, ) -> Pin<Box<dyn Future<Output = Result<SyncResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Sync files for a single path within the module.

The path should be relative to the module root.

Source

fn sync_all<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 SyncContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<SyncResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Sync all applicable paths in the module.

Iterates through all instances in the module that have configuration for this provider and syncs each one.

Implementors§