Skip to content

Commit 3669d63

Browse files
committed
feat(rengine/printer): intro Allocator::new
1 parent 24ddd6c commit 3669d63

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rust-engine/src/printer/allocator.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ pub struct Allocator<Printer> {
1212
pub printer: Printer,
1313
}
1414

15+
impl<Printer> Allocator<Printer> {
16+
/// Creates a new allocator from a printer.
17+
pub fn new(printer: Printer) -> Self {
18+
Self {
19+
allocator: BoxAllocator,
20+
printer,
21+
}
22+
}
23+
}
24+
1525
impl<'a, P, A: 'a> DocAllocator<'a, A> for Allocator<P> {
1626
type Doc = <BoxAllocator as DocAllocator<'a, A>>::Doc;
1727

0 commit comments

Comments
 (0)