-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Add an origin parameter to Buffer
Maybe we can do this:
struct Buffer[
mut: Bool, //, *,
origin: Origin[mut],
... # alignment etc.
](Movable):
alias _U = UnsafePointer[UInt8, mut=mut, origin=origin] # alignment etc.
# these two fields could also be replaced by `Span[UInt8, origin]`
var ptr: Self._U
var size: Int
var owns: Bool
fn __init__(out self, ptr: Self._U, size: Int, owns: Bool = True):
self.ptr = ptr
self.size = size
self.owns = owns
fn alloc[I: Intable, //, T: DType = DType.uint8](length: I) -> Buffer[origin=MutableAnyOrigin.empty]: ...
origins are kept throughout the code this way which is much safer. It will involve a lot of work though.
Metadata
Metadata
Assignees
Labels
No labels