pub struct Assembler { /* private fields */ }Expand description
Assembler for SBPF assembly code
Implementations§
Source§impl Assembler
impl Assembler
Sourcepub fn new(options: AssemblerOption) -> Self
pub fn new(options: AssemblerOption) -> Self
Create a new Assembler with the given options
Sourcepub fn assemble(&self, source: &str) -> Result<Vec<u8>, Vec<CompileError>>
pub fn assemble(&self, source: &str) -> Result<Vec<u8>, Vec<CompileError>>
Assemble source code directly (no preprocessing). This is the original API – macros and includes are not supported.
Sourcepub fn assemble_with_preprocess(
&self,
source: &str,
source_path: &str,
resolver: Option<&dyn FileResolver>,
) -> Result<Vec<u8>, AssembleErrors>
pub fn assemble_with_preprocess( &self, source: &str, source_path: &str, resolver: Option<&dyn FileResolver>, ) -> Result<Vec<u8>, AssembleErrors>
Assemble with preprocessing: resolves .include and expands .macro directives
before parsing. Errors include source location information from the source map,
and the file registry is returned so callers can render diagnostics against
original source files.
Sourcepub fn assemble_file(&self, path: &Path) -> Result<Vec<u8>, AssembleErrors>
pub fn assemble_file(&self, path: &Path) -> Result<Vec<u8>, AssembleErrors>
Convenience method: read a file from disk and assemble with full preprocessing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Assembler
impl RefUnwindSafe for Assembler
impl Send for Assembler
impl Sync for Assembler
impl Unpin for Assembler
impl UnsafeUnpin for Assembler
impl UnwindSafe for Assembler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more