Struct inkwell::memory_buffer::MemoryBuffer
source · pub struct MemoryBuffer { /* private fields */ }
Implementations§
source§impl MemoryBuffer
impl MemoryBuffer
pub unsafe fn new(memory_buffer: LLVMMemoryBufferRef) -> Self
pub fn as_mut_ptr(&self) -> LLVMMemoryBufferRef
pub fn create_from_file(path: &Path) -> Result<Self, LLVMString>
pub fn create_from_stdin() -> Result<Self, LLVMString>
sourcepub fn create_from_memory_range(input: &[u8], name: &str) -> Self
pub fn create_from_memory_range(input: &[u8], name: &str) -> Self
This function is likely slightly cheaper than create_from_memory_range_copy
since it intentionally
leaks data to LLVM so that it doesn’t have to reallocate. create_from_memory_range_copy
may be removed
in the future
sourcepub fn create_from_memory_range_copy(input: &[u8], name: &str) -> Self
pub fn create_from_memory_range_copy(input: &[u8], name: &str) -> Self
This will create a new MemoryBuffer
from the given input.
This function is likely slightly more expensive than create_from_memory_range
since it does not leak
data to LLVM, forcing LLVM to make a copy. This function may be removed in the future in favor of
create_from_memory_range
sourcepub fn create_object_file(self) -> Result<ObjectFile, ()>
pub fn create_object_file(self) -> Result<ObjectFile, ()>
Convert this MemoryBuffer
into an ObjectFile
. LLVM does not currently
provide any way to determine the cause of error if conversion fails.
Trait Implementations§
source§impl Debug for MemoryBuffer
impl Debug for MemoryBuffer
Auto Trait Implementations§
impl Freeze for MemoryBuffer
impl RefUnwindSafe for MemoryBuffer
impl !Send for MemoryBuffer
impl !Sync for MemoryBuffer
impl Unpin for MemoryBuffer
impl UnwindSafe for MemoryBuffer
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> 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