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.