You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
635 B
Rust
24 lines
635 B
Rust
4 years ago
|
use crate::error::Error;
|
||
|
use super::Section;
|
||
|
|
||
|
pub trait Output {
|
||
|
fn allocate(&mut self, size: u64) -> Result<u64, Error>;
|
||
|
|
||
|
fn append_section(&mut self, section: &Section) -> Result<(), Error>;
|
||
|
|
||
|
// fn prepare_symbol<V, S>(&mut self, symbol: impl Lazy<V, S>) -> Result<&mut Self, Error>;
|
||
|
}
|
||
|
|
||
|
pub struct DummyOutput;
|
||
|
|
||
|
impl Output for DummyOutput {
|
||
|
fn allocate(&mut self, size: u64) -> Result<u64, Error> {
|
||
|
eprintln!("Allocating: {}", size);
|
||
|
Ok(size)
|
||
|
}
|
||
|
|
||
|
fn append_section(&mut self, section: &Section) -> Result<(), Error> {
|
||
|
eprintln!("Appending section: {}", section);
|
||
|
Ok(())
|
||
|
}
|
||
|
}
|