Skip to content

Instantly share code, notes, and snippets.

@richo
Created November 17, 2020 04:05
Show Gist options
  • Save richo/c044de1ec9a9cb2d4ee84eddb463e4fd to your computer and use it in GitHub Desktop.
Save richo/c044de1ec9a9cb2d4ee84eddb463e4fd to your computer and use it in GitHub Desktop.
impl PathWithTransform for RemotePathDescriptor {
type Output = RemotePathDescriptor;
fn with_modification<T: AsTransform>(&self, detail: &T) -> RemotePathDescriptor {
use RemotePathDescriptor::*;
let tweak = detail.as_transform().tweak_name();
match self {
dt @ DateTime { .. } => dt.clone(),
dn @ DateName { .. } => {
let new = dn.clone();
new.name.push_str(tweak);
new
},
sp @ SpecifiedPath { .. } => {
let new = sp.clone();
new.name.push_str(tweak);
new
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment