[−][src]Struct faerie::artifact::Artifact
An abstract binary artifact, which contains code, data, imports, and relocations
Fields
name: String
The name of this artifact
target: Triple
The machine target this is intended for
is_library: bool
Whether this is a static library or not
Methods
impl Artifact
[src]
pub fn new(target: Triple, name: String) -> Self
[src]
Create a new binary Artifact, with target
and optional name
pub fn imports<'a>(
&'a self
) -> Box<dyn Iterator<Item = (&'a str, &'a ImportKind)> + 'a>
[src]
&'a self
) -> Box<dyn Iterator<Item = (&'a str, &'a ImportKind)> + 'a>
Get an iterator over this artifact's imports
pub fn declare_with<T: AsRef<str>, D: Into<Decl>>(
&mut self,
name: T,
decl: D,
definition: Vec<u8>
) -> Result<(), Error>
[src]
&mut self,
name: T,
decl: D,
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
pub fn declare<T: AsRef<str>, D: Into<Decl>>(
&mut self,
name: T,
decl: D
) -> Result<(), ArtifactError>
[src]
&mut self,
name: T,
decl: D
) -> Result<(), ArtifactError>
Declare a new symbolic reference, with the given decl
.
Note: All declarations must precede their definitions.
pub fn declarations<T: AsRef<str>, D: Iterator<Item = (T, Decl)>>(
&mut self,
declarations: D
) -> Result<(), Error>
[src]
&mut self,
declarations: D
) -> Result<(), Error>
pub 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.
pub 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)
pub 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.
pub fn link_with<'a>(
&mut self,
link: Link<'a>,
reloc: Reloc
) -> Result<(), Error>
[src]
&mut self,
link: Link<'a>,
reloc: Reloc
) -> Result<(), Error>
A variant of link
with a Reloc
provided. Has all of the same invariants as
link
.
pub fn undefined_symbols(&self) -> Vec<String>
[src]
Get set of non-import declarations that have not been defined. This must be an empty set in
order to emit
the artifact.
pub fn emit(&self) -> Result<Vec<u8>, Error>
[src]
Emit a blob of bytes representing the object file in the format specified in the target the
Artifact
was constructed with.
pub fn emit_as(&self, format: BinaryFormat) -> Result<Vec<u8>, Error>
[src]
Emit a blob of bytes representing an object file in the given format.
pub fn write(&self, sink: File) -> Result<(), Error>
[src]
Emit and write to disk a blob of bytes representing the object file in the format specified
in the target the Artifact
was constructed with.
pub fn write_as(&self, sink: File, format: BinaryFormat) -> Result<(), Error>
[src]
Emit and write to disk a blob of bytes representing an object file in the given format.
Trait Implementations
impl Clone for Artifact
[src]
fn clone(&self) -> Artifact
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Artifact
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,