Remove private macro
This commit is contained in:
parent
a1a85f40d0
commit
fd6a7f877a
1 changed files with 37 additions and 22 deletions
|
@ -54,13 +54,24 @@ macro_rules! make_unique_ref_path_generator {
|
||||||
=> with collection name $collectionname:expr
|
=> with collection name $collectionname:expr
|
||||||
) => {
|
) => {
|
||||||
struct $name;
|
struct $name;
|
||||||
impl_unique_ref_path_generator_trait!(
|
|
||||||
$name
|
impl $crate::refstore::UniqueRefPathGenerator for $name {
|
||||||
over $underlying
|
type Error = $errtype;
|
||||||
=> with error $errtype
|
|
||||||
=> with collection name $collectionname
|
fn collection() -> &'static str {
|
||||||
=> |p| { $underlying::unique_hash(p) } => |s| { Ok(s) }
|
$collectionname
|
||||||
);
|
}
|
||||||
|
|
||||||
|
fn unique_hash<A: AsRef<Path>>(path: A) -> Result<String, Self::Error> {
|
||||||
|
$underlying::unique_hash(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn postprocess_storeid(sid: ::libimagstore::storeid::StoreId)
|
||||||
|
-> Result<::libimagstore::storeid::StoreId, Self::Error>
|
||||||
|
{
|
||||||
|
Ok(sid)
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -71,13 +82,24 @@ macro_rules! make_unique_ref_path_generator {
|
||||||
=> $impl:expr
|
=> $impl:expr
|
||||||
) => {
|
) => {
|
||||||
struct $name;
|
struct $name;
|
||||||
impl_unique_ref_path_generator_trait!(
|
|
||||||
$name
|
impl $crate::refstore::UniqueRefPathGenerator for $name {
|
||||||
over $underlying
|
type Error = $errtype;
|
||||||
=> with error $errtype
|
|
||||||
=> with collection name $collectionname
|
fn collection() -> &'static str {
|
||||||
=> $impl => |sid| { Ok(sid) }
|
$collectionname
|
||||||
);
|
}
|
||||||
|
|
||||||
|
fn unique_hash<A: AsRef<Path>>(path: A) -> Result<String, Self::Error> {
|
||||||
|
$impl(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn postprocess_storeid(sid: ::libimagstore::storeid::StoreId)
|
||||||
|
-> Result<::libimagstore::storeid::StoreId, Self::Error>
|
||||||
|
{
|
||||||
|
Ok(sid)
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -105,14 +127,7 @@ macro_rules! make_unique_ref_path_generator {
|
||||||
=> $postproc:expr
|
=> $postproc:expr
|
||||||
) => {
|
) => {
|
||||||
pub struct $name;
|
pub struct $name;
|
||||||
impl_unique_ref_path_generator_trait!(
|
|
||||||
$name, $underlying, $errtype, $collectionname => $impl => $postproc
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! impl_unique_ref_path_generator_trait {
|
|
||||||
($name:ident, $underlying:ty, $errtype:ty, $collectionname:expr => $impl:expr => $postproc:expr) => {
|
|
||||||
impl $crate::refstore::UniqueRefPathGenerator for $name {
|
impl $crate::refstore::UniqueRefPathGenerator for $name {
|
||||||
type Error = $errtype;
|
type Error = $errtype;
|
||||||
|
|
||||||
|
@ -130,7 +145,7 @@ macro_rules! impl_unique_ref_path_generator_trait {
|
||||||
$postproc(sid)
|
$postproc(sid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue