Struct faerie::artifact::Artifact
[−]
[src]
pub struct Artifact { pub name: String, pub target: Target, pub is_library: bool, // some fields omitted }
An abstract binary artifact, which contains code, data, imports, and relocations
Fields
name: String
The name of this artifact
target: Target
The machine target this is intended for
is_library: bool
Whether this is a static library or not
Methods
impl Artifact
[src]
fn new(target: Target, name: String) -> Self
[src]
Create a new binary Artifact, with target
and optional name
fn imports<'a>(&'a self) -> Box<Iterator<Item = (&'a str, &'a ImportKind)> + 'a>
[src]
Get an iterator over this artifact's imports
fn declare_with<T: AsRef<str>>(
&mut self,
name: T,
decl: Decl,
definition: Vec<u8>
) -> Result<(), Error>
[src]
&mut self,
name: T,
decl: Decl,
definition: Vec<u8>
) -> Result<(), Error>
Declare and define a new symbolic reference with the given decl
and given definition
.
This is sugar for declare
and then define
fn declare<T: AsRef<str>>(&mut self, name: T, decl: Decl) -> Result<(), Error>
[src]
Declare a new symbolic reference, with the given decl
.
Note: All declarations must precede their definitions.
fn declarations<T: AsRef<str>, D: Iterator<Item = (T, Decl)>>(
&mut self,
declarations: D
) -> Result<(), Error>
[src]
&mut self,
declarations: D
) -> Result<(), Error>
fn define<T: AsRef<str>>(
&mut self,
name: T,
data: Vec<u8>
) -> Result<(), ArtifactError>
[src]
&mut self,
name: T,
data: Vec<u8>
) -> Result<(), ArtifactError>
Defines a previously declared program object. NB: If you attempt to define an import, this will return an error. If you attempt to define something which has not been declared, this will return an error.
fn import<T: AsRef<str>>(
&mut self,
import: T,
kind: ImportKind
) -> Result<(), Error>
[src]
&mut self,
import: T,
kind: ImportKind
) -> Result<(), Error>
Declare import
to be an import with kind
.
This is just sugar for declare("name", Decl::FunctionImport)
or declare("data", Decl::DataImport)
fn link<'a>(&mut self, link: Link<'a>) -> Result<(), Error>
[src]
Link a relocation at link.at
from link.from
to link.to
NB: If either link.from
or link.to
is undeclared, then this will return an error.
If link.from
is an import you previously declared, this will also return an error.
fn link_with<'a>(
&mut self,
link: Link<'a>,
reloc: RelocOverride
) -> Result<(), Error>
[src]
&mut self,
link: Link<'a>,
reloc: RelocOverride
) -> Result<(), Error>
A variant of link
with a RelocOverride provided. Has all of the same invariants as
link
.
fn emit<O: Object>(&self) -> Result<Vec<u8>, Error>
[src]
Emit a blob of bytes that represents this object file
fn write<O: Object>(&self, sink: File) -> Result<(), Error>
[src]
Emit and write to disk a blob of bytes that represents this object file