mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-16 09:11:55 +00:00
graphlog: remove use of PhantomData
This commit is contained in:
parent
0b99e5b16e
commit
8248d6e8f6
1 changed files with 9 additions and 12 deletions
|
@ -15,7 +15,6 @@
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use jujutsu_lib::settings::UserSettings;
|
use jujutsu_lib::settings::UserSettings;
|
||||||
|
@ -58,10 +57,9 @@ pub trait GraphLog<K: Clone + Eq + Hash> {
|
||||||
) -> io::Result<()>;
|
) -> io::Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SaplingGraphLog<'writer, K, R: Renderer<K, Output = String>> {
|
pub struct SaplingGraphLog<'writer, R> {
|
||||||
renderer: R,
|
renderer: R,
|
||||||
writer: &'writer mut dyn Write,
|
writer: &'writer mut dyn Write,
|
||||||
phantom: PhantomData<K>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone> From<&Edge<K>> for Ancestor<K> {
|
impl<K: Clone> From<&Edge<K>> for Ancestor<K> {
|
||||||
|
@ -77,7 +75,7 @@ impl<K: Clone> From<&Edge<K>> for Ancestor<K> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'writer, K, R> GraphLog<K> for SaplingGraphLog<'writer, K, R>
|
impl<'writer, K, R> GraphLog<K> for SaplingGraphLog<'writer, R>
|
||||||
where
|
where
|
||||||
K: Clone + Eq + Hash,
|
K: Clone + Eq + Hash,
|
||||||
R: Renderer<K, Output = String>,
|
R: Renderer<K, Output = String>,
|
||||||
|
@ -100,19 +98,18 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'writer, K, R> SaplingGraphLog<'writer, K, R>
|
impl<'writer, R> SaplingGraphLog<'writer, R> {
|
||||||
where
|
pub fn create<K>(
|
||||||
K: Clone + Eq + Hash + 'writer,
|
|
||||||
R: Renderer<K, Output = String> + 'writer,
|
|
||||||
{
|
|
||||||
pub fn create(
|
|
||||||
renderer: R,
|
renderer: R,
|
||||||
formatter: &'writer mut dyn Write,
|
formatter: &'writer mut dyn Write,
|
||||||
) -> Box<dyn GraphLog<K> + 'writer> {
|
) -> Box<dyn GraphLog<K> + 'writer>
|
||||||
|
where
|
||||||
|
K: Clone + Eq + Hash + 'writer,
|
||||||
|
R: Renderer<K, Output = String> + 'writer,
|
||||||
|
{
|
||||||
Box::new(SaplingGraphLog {
|
Box::new(SaplingGraphLog {
|
||||||
renderer,
|
renderer,
|
||||||
writer: formatter,
|
writer: formatter,
|
||||||
phantom: PhantomData,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue