Skip to content

storage #

Constants #

const vector_minimum_capacity = 2
const vector_growth_factor = 2
const vector_shrink_threshold = 1.0 / 4.0

fn from_array #

fn from_array[T](arr []T) &CpuStorage[T]

fn storage #

fn storage[T](len int, cap int, init T) &CpuStorage[T]

fn (CpuStorage[T]) get #

fn (s &CpuStorage[T]) get[T](i int) T

Private function. Used to implement the Storage operator

fn (CpuStorage[T]) set #

fn (mut s CpuStorage[T]) set[T](i int, val T)

Private function. Used to implement assignments to the Storage element

fn (CpuStorage[T]) fill #

fn (mut s CpuStorage[T]) fill[T](val T)

fill fills an entire storage with a given value

fn (CpuStorage[T]) clone #

fn (s &CpuStorage[T]) clone[T]() &CpuStorage[T]

clone returns an independent copy of a given Storage

fn (CpuStorage[T]) like #

fn (s &CpuStorage[T]) like[T]() &CpuStorage[T]

like returns an independent copy of a given Storage

fn (CpuStorage[T]) like_with_len #

fn (s &CpuStorage[T]) like_with_len[T](len int) &CpuStorage[T]

like_with_len returns an independent copy of a given Storage

fn (CpuStorage[T]) offset #

fn (s &CpuStorage[T]) offset[T](start int) &CpuStorage[T]

fn (CpuStorage[T]) to_array #

fn (s &CpuStorage[T]) to_array[T]() []T

struct CpuStorage #

@[heap]
struct CpuStorage[T] {
pub mut:
	data []T
}

CpuStorage