pub struct ProcessSyncEnv { /* private fields */ }Expand description
Runs folder transfers as operating-system processes.
Implementations§
Source§impl ProcessSyncEnv
impl ProcessSyncEnv
Sourcepub fn new(observations: Sender<SyncObservation>) -> Self
pub fn new(observations: Sender<SyncObservation>) -> Self
Runs transfers, stating every observation it reads to the given receiver.
Sourcepub const fn held(
observations: Sender<SyncObservation>,
hold: ProcessHold,
) -> Self
pub const fn held( observations: Sender<SyncObservation>, hold: ProcessHold, ) -> Self
Runs transfers that whoever holds this handle can hold still and let go again.
Trait Implementations§
Source§impl Debug for ProcessSyncEnv
impl Debug for ProcessSyncEnv
Source§impl RsyncEndpointAlg for ProcessSyncEnvwhere
RsyncSyntax: RsyncEndpointAlg,
impl RsyncEndpointAlg for ProcessSyncEnvwhere
RsyncSyntax: RsyncEndpointAlg,
Source§impl RsyncEndpointViewAlg for ProcessSyncEnvwhere
RsyncSyntax: RsyncEndpointViewAlg,
impl RsyncEndpointViewAlg for ProcessSyncEnvwhere
RsyncSyntax: RsyncEndpointViewAlg,
Source§fn endpoint_user<'a>(&self, endpoint: &'a Self::Endpoint) -> Option<&'a str>
fn endpoint_user<'a>(&self, endpoint: &'a Self::Endpoint) -> Option<&'a str>
Source§fn endpoint_host<'a>(&self, endpoint: &'a Self::Endpoint) -> Option<&'a str>
fn endpoint_host<'a>(&self, endpoint: &'a Self::Endpoint) -> Option<&'a str>
Source§fn endpoint_path<'a>(&self, endpoint: &'a Self::Endpoint) -> &'a str
fn endpoint_path<'a>(&self, endpoint: &'a Self::Endpoint) -> &'a str
Source§impl RsyncSorts for ProcessSyncEnv
impl RsyncSorts for ProcessSyncEnv
Source§type Endpoint = RsyncEndpoint
type Endpoint = RsyncEndpoint
Source§type Command = SyncCommand
type Command = SyncCommand
Source§type Observation = SyncObservation
type Observation = SyncObservation
Source§type Change = PlannedChange
type Change = PlannedChange
Source§impl SyncChangeAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncChangeAlg,
impl SyncChangeAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncChangeAlg,
Source§fn sync_change(
&self,
path: impl Into<String>,
kind: ChangeKind,
size: Option<u64>,
) -> Self::Change
fn sync_change( &self, path: impl Into<String>, kind: ChangeKind, size: Option<u64>, ) -> Self::Change
Source§impl SyncCommandAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncCommandAlg,
impl SyncCommandAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncCommandAlg,
Source§fn sync_command(
&self,
program: impl Into<String>,
arguments: impl IntoIterator<Item = String>,
) -> Self::Command
fn sync_command( &self, program: impl Into<String>, arguments: impl IntoIterator<Item = String>, ) -> Self::Command
Source§impl SyncCommandViewAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncCommandViewAlg,
impl SyncCommandViewAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncCommandViewAlg,
Source§impl SyncObservationAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncObservationAlg,
impl SyncObservationAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncObservationAlg,
Source§fn observed_change(&self, change: Self::Change) -> Self::Observation
fn observed_change(&self, change: Self::Change) -> Self::Observation
Source§fn observed_progress(&self, transferred: u64, percent: u16) -> Self::Observation
fn observed_progress(&self, transferred: u64, percent: u16) -> Self::Observation
Source§fn observed_nothing(&self) -> Self::Observation
fn observed_nothing(&self) -> Self::Observation
Source§impl SyncObservationViewAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncObservationViewAlg,
impl SyncObservationViewAlg for ProcessSyncEnvwhere
RsyncSyntax: SyncObservationViewAlg,
Source§fn observation_change<'a>(
&self,
observation: &'a Self::Observation,
) -> Option<&'a Self::Change>
fn observation_change<'a>( &self, observation: &'a Self::Observation, ) -> Option<&'a Self::Change>
Source§fn observation_progress(
&self,
observation: &Self::Observation,
) -> Option<(u64, u16)>
fn observation_progress( &self, observation: &Self::Observation, ) -> Option<(u64, u16)>
Source§impl SyncRunAlg for ProcessSyncEnv
impl SyncRunAlg for ProcessSyncEnv
Source§type Error = ProcessSyncError
type Error = ProcessSyncError
Source§fn start_sync(&self, command: &Self::Command) -> Result<Self::Run, Self::Error>
fn start_sync(&self, command: &Self::Command) -> Result<Self::Run, Self::Error>
Source§impl SyncWatchAlg for ProcessSyncEnv
impl SyncWatchAlg for ProcessSyncEnv
Source§fn watch_sync(&self, observation: &Self::Observation)
fn watch_sync(&self, observation: &Self::Observation)
Auto Trait Implementations§
impl Freeze for ProcessSyncEnv
impl RefUnwindSafe for ProcessSyncEnv
impl Send for ProcessSyncEnv
impl Sync for ProcessSyncEnv
impl Unpin for ProcessSyncEnv
impl UnsafeUnpin for ProcessSyncEnv
impl UnwindSafe for ProcessSyncEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<This> GaugeLaws<This> for This
impl<This> GaugeLaws<This> for This
Source§fn gauge_laws(&self) -> Result<(), Error>
fn gauge_laws(&self) -> Result<(), Error>
Checks that a gauge states a share without claiming more resolution than it has.
The laws checked are:
- a gauge occupies its stated width whatever share it states;
- no share is stated as filled before it is reached, and none is stated twice;
- nothing stated is nothing filled, and everything stated fills the whole track;
- the stated text occupies exactly one cell per counted cell.
§Errors
Returns the first violated law.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<This> IntoExt<This> for This
impl<This> IntoExt<This> for This
Source§fn to<R>(self) -> Rwhere
This: Into<R>,
fn to<R>(self) -> Rwhere
This: Into<R>,
A version of Into::into function that can be used to explicitly specify the target
conversion type.
use alux_sdk::*;
// `Into` requires context to infer the type,
let _: i64 = Into::into(42_i8);
// The opposite `From` requires context to infer the type,
let _: i64 = From::from(42_i8);
// `.to()` can be used in the same way as a postfix function (the same as `.into()`),
let _: i64 = 42_i8.to();
// but also with the type specified explicitly.
let _ = 42_i8.to::<i64>();
// Especially useful to chain multiple conversions inline.
let _: i64 = 42_i8.to::<i16>().to::<i32>().into();Source§impl<This> IntoIteratorExt<This> for This
impl<This> IntoIteratorExt<This> for This
Source§fn try_collect_vec<T, E>(self) -> Result<Vec<T>, E>
fn try_collect_vec<T, E>(self) -> Result<Vec<T>, E>
A variant of the try_collect and collect_vec combined function from the Itertools
library. The materialized value is a Vec inside a Result object.
Returns the first error without collecting later values.
use alux_sdk::*;
let values = [Ok::<_, &str>(1), Ok(2), Ok(3)]
.into_iter()
.try_collect_vec();
assert_eq!(values, Ok(vec![1, 2, 3]));Source§fn collect_exact<T>(self, n: usize) -> Option<Vec<T>>where
This: Iterator<Item = T>,
fn collect_exact<T>(self, n: usize) -> Option<Vec<T>>where
This: Iterator<Item = T>,
Takes exactly n elements from the iterator.
Returns Some(Vec<T>) if the iterator yields exactly n elements,
otherwise returns None.
use alux_sdk::*;
let v = [1, 2, 3];
assert_eq!(v.iter().copied().collect_exact(3), Some(vec![1, 2, 3]));
assert_eq!(v.iter().copied().collect_exact(4), None);
assert_eq!(v.iter().copied().collect_exact(2), None);Source§fn try_unzip<A, B, E>(self) -> Result<(Vec<A>, Vec<B>), E>
fn try_unzip<A, B, E>(self) -> Result<(Vec<A>, Vec<B>), E>
Efficiently splits an iterator of Result<(A, B), E> into two Vecs, short-circuiting on error.
Consumes the iterator, collecting all A elements into one vector and all B elements into another,
without first allocating an intermediate vector of tuples. Returns the tuple (Vec<A>, Vec<B>) on success,
or the first error encountered.
use alux_sdk::*;
let input = vec![Ok((1, "x")), Ok((2, "y"))];
let (xs, ys) = input.try_unzip::<_, _, ()>().unwrap();
assert_eq!(xs, vec![1, 2]);
assert_eq!(ys, vec!["x", "y"]);Source§impl<This> RsyncEndpointExt<This> for Thiswhere
This: RsyncEndpointAlg + RsyncEndpointViewAlg,
impl<This> RsyncEndpointExt<This> for Thiswhere
This: RsyncEndpointAlg + RsyncEndpointViewAlg,
Source§fn read_endpoint(&self, input: &str) -> <This as RsyncSorts>::Endpoint
fn read_endpoint(&self, input: &str) -> <This as RsyncSorts>::Endpoint
Reads one endpoint from the text somebody submitted.
Three shapes name a path on another machine: a daemon URL, and a machine and a path separated by a colon with nothing path-like before it. A text naming any other scheme names a resource somewhere else, and a text naming neither names a path here.
Source§fn read_transfer(
&self,
line: &str,
) -> Option<(<This as RsyncSorts>::Endpoint, <This as RsyncSorts>::Endpoint)>
fn read_transfer( &self, line: &str, ) -> Option<(<This as RsyncSorts>::Endpoint, <This as RsyncSorts>::Endpoint)>
Reads one submitted line as the two ends of a transfer, when it names two.
A transfer is written the way it is run: what comes from, then what it comes to. Anything naming how rather than what — the program itself, and the arguments given to it — is already stated by the transfer, so a whole command can be submitted and still be read.
Source§fn endpoint_remote(&self, endpoint: &<This as RsyncSorts>::Endpoint) -> bool
fn endpoint_remote(&self, endpoint: &<This as RsyncSorts>::Endpoint) -> bool
Observes whether the path rests on another machine.
Source§fn endpoint_text(&self, endpoint: &<This as RsyncSorts>::Endpoint) -> String
fn endpoint_text(&self, endpoint: &<This as RsyncSorts>::Endpoint) -> String
States the endpoint the way the transfer program is given it.
Source§fn endpoint_name<'a>(
&self,
endpoint: &'a <This as RsyncSorts>::Endpoint,
) -> &'a str
fn endpoint_name<'a>( &self, endpoint: &'a <This as RsyncSorts>::Endpoint, ) -> &'a str
Names what the path ends with, without the path that leads to it.
Source§impl<This> SyncCommandExt<This> for This
impl<This> SyncCommandExt<This> for This
Source§fn transfer_command(
&self,
source: &<This as RsyncSorts>::Endpoint,
destination: &<This as RsyncSorts>::Endpoint,
mode: SyncMode,
) -> <This as RsyncSorts>::Command
fn transfer_command( &self, source: &<This as RsyncSorts>::Endpoint, destination: &<This as RsyncSorts>::Endpoint, mode: SyncMode, ) -> <This as RsyncSorts>::Command
States the command transferring one endpoint into another.
What is transferred may be one file or a whole folder, and each end is stated exactly as it was written. A source ending with a separator names the contents of a folder; one without names the path itself, which comes to rest inside the destination. Both are wanted, so neither is invented here.
Source§fn command_rehearses(&self, command: &<This as RsyncSorts>::Command) -> bool
fn command_rehearses(&self, command: &<This as RsyncSorts>::Command) -> bool
Observes whether the command states what it would do instead of doing it.
Source§fn command_mirrors(&self, command: &<This as RsyncSorts>::Command) -> bool
fn command_mirrors(&self, command: &<This as RsyncSorts>::Command) -> bool
Observes whether the command removes what the source no longer holds.
Source§impl<This> SyncProgramExt<This> for Thiswhere
This: SyncRunAlg + SyncWatchAlg + SyncChangeAlg + SyncObservationAlg + SyncObservationViewAlg,
<This as RsyncSorts>::Change: Clone,
impl<This> SyncProgramExt<This> for Thiswhere
This: SyncRunAlg + SyncWatchAlg + SyncChangeAlg + SyncObservationAlg + SyncObservationViewAlg,
<This as RsyncSorts>::Change: Clone,
Source§fn run_sync(
&self,
command: &<This as RsyncSorts>::Command,
) -> Result<Vec<<This as RsyncSorts>::Change>, <This as SyncRunAlg>::Error>
fn run_sync( &self, command: &<This as RsyncSorts>::Command, ) -> Result<Vec<<This as RsyncSorts>::Change>, <This as SyncRunAlg>::Error>
Runs one transfer and states every change it named, in the order it named them.
Every line is watched as it arrives, so an interpreter following a transfer sees progress while it runs rather than after it ends.
§Errors
Returns the failure that started, read, or ended the transfer.
Source§impl<This> SyncReadExt<This> for Thiswhere
This: SyncChangeAlg + SyncObservationAlg,
impl<This> SyncReadExt<This> for Thiswhere
This: SyncChangeAlg + SyncObservationAlg,
Source§fn read_sync_line(&self, line: &str) -> <This as RsyncSorts>::Observation
fn read_sync_line(&self, line: &str) -> <This as RsyncSorts>::Observation
Reads one line the transfer program wrote as what it states.
A change is stated in three fields: the flags naming what happens, the byte count, and the path. Anything else on the stream is progress, or is nothing this specification reads.
Source§fn read_sync_change(&self, line: &str) -> Option<<This as RsyncSorts>::Change>
fn read_sync_change(&self, line: &str) -> Option<<This as RsyncSorts>::Change>
Reads one itemized line as the change it denotes, and states nothing for a line naming only that a folder was opened on the way to what is inside it.