API
Modules
Types and constants
StaticThings.AxesLike
StaticThings.IntegerLike
StaticThings.NoTypeSize
StaticThings.OneToLike
StaticThings.RealLike
StaticThings.SizeLike
StaticThings.StaticAxesLike
StaticThings.StaticOneTo
StaticThings.StaticOneToLike
StaticThings.StaticSizeLike
StaticThings.StaticUnitRange
StaticThings.StaticUnitRangeLike
Functions and macros
StaticThings.asaxes
StaticThings.asnonstatic
StaticThings.axes2size
StaticThings.canonical_axes
StaticThings.canonical_indices
StaticThings.canonical_size
StaticThings.maybestatic_axes
StaticThings.maybestatic_eachindex
StaticThings.maybestatic_fill
StaticThings.maybestatic_first
StaticThings.maybestatic_last
StaticThings.maybestatic_length
StaticThings.maybestatic_oneto
StaticThings.maybestatic_reshape
StaticThings.maybestatic_size
StaticThings.size2axes
StaticThings.size2length
StaticThings.size_from_type
StaticThings.staticarray_type
Documentation
StaticThings.StaticThings
— ModuleStaticThings
StaticThings provides tools to help write generic code that works with both static and non-static values and arrays.
StaticThings.AxesLike
— TypeAxesLike = Union{Tuple{},Tuple{Vararg{AbstractVector{<:IntegerLike}}}}
Something that can represent axes of a collection.
StaticThings.NoTypeSize
— TypeStaticThings.NoTypeSize(T)
Returned by StaticThings.size_from_type(T)
if the size of values of type T
is not fixed or not known.
StaticThings.StaticAxesLike
— TypeStaticAxesLike = Tuple{Vararg{Union{StaticArrays.SOneTo,StaticArrays.SUnitRange,Static.SUnitRange}}}
Something that can represent axes of a statically sized collection.
StaticThings.StaticOneTo
— Typeconst StaticOneTo{T} = StaticArrays.SOneTo{T}
The StaticThings default type for static one-based unit ranges.
Currently an alias for StaticArrays.SOneTo.
StaticThings.StaticUnitRange
— TypeStaticUnitRange
The StaticThings default type for static unit ranges.
Currently an alias for StaticArrays.SUnitRange
, if it exists, otherwise an alias for Static.SUnitRange
.
StaticThings.IntegerLike
— TypeIntegerLike = Union{Integer,Static.StaticInteger}
A static of dynamic integer value.
StaticThings.OneToLike
— TypeOneToLike = Union{Base.OneTo,StaticArrays.SOneTo,Static.SOneTo}
Alias for unit ranges that start at one.
StaticThings.RealLike
— TypeRealLike = `Union{Real,Static.StaticInteger}`
A static or dynamic real value.
StaticThings.SizeLike
— TypeSizeLike = Union{Tuple{},Tuple{Vararg{IntegerLike}},StaticArrays.Size}
Something that can represent the size of a collection.
StaticThings.StaticOneToLike
— TypeStaticOneToLike{N} = Union{StaticArrays.SOneTo{N},Static.SOneTo{N}}
A static unit range from one to N.
StaticThings.StaticSizeLike
— TypeStaticSizeLike = Union{Tuple{Vararg{StaticInteger}},StaticArrays.Size}
Something that can represent the size of a statically sized collection.
StaticThings.StaticUnitRangeLike
— TypeStaticUnitRangeLike = Union{StaticArrays.SOneTo,StaticArrays.SUnitRange,Static.SUnitRange}
A static unit range.
StaticThings.asaxes
— Functionasaxes(axs::AxesLike)
asaxes(sz::SizeLike)
asaxes(len::IntegerLike)
Converts axes or a size or a length of a collection to axes.
One-based indexing will be used if the indexing offset can't be inferred from the given dimensions.
StaticThings.asnonstatic
— Functionasnonstatic(x)
Return a non-static equivalent of x
.
Defaults to Static.dynamic(x)
.
StaticThings.axes2size
— FunctionStaticThings.axes2size(x::Tuple)
StaticThings.axes2size(x::StaticArrays.Size)
Get the size of a collection-like object from it's axes.
StaticThings.canonical_axes
— Functioncanonical_axes(sz::SizeLike)
Return the canonical representation collection axes.
StaticThings.canonical_indices
— Functioncanonical_indices(idxs::AbstractVector{<:IntegerLike})
Return the canonical representation of a collection axis indices.
StaticThings.canonical_size
— Functioncanonical_size(sz::SizeLike)
Return the canonical representation of a collection size.
StaticThings.maybestatic_axes
— Functionmaybestatic_axes(x)::Tuple{Vararg{IntegerLike}}
Returns the size of x
as a tuple of dynamic or static integers.
StaticThings.maybestatic_eachindex
— Functionmaybestatic_eachindex(x)
Returns the the index range of x
as a dynamic or static integer range
StaticThings.maybestatic_fill
— Functionmaybestatic_fill(x, sz::NTuple{N,<:IntegerLike}) where N
Creates an array of size sz
filled with x
.
The result will typically be either a FillArrays.Fill
or a StaticArrays.StaticArray
.
StaticThings.maybestatic_first
— Functionmaybestatic_first(A)
Returns the first element of A
as a dynamic or static value.
StaticThings.maybestatic_last
— Functionmaybestatic_last(A)
Returns the last element of A
as a dynamic or static value.
StaticThings.maybestatic_length
— Functionmaybestatic_length(x)
Returns the length of x
as a dynamic or static integer.
StaticThings.maybestatic_oneto
— Functionmaybestatic_oneto(n::IntegerLike)
Creates a range from one to n.
Returns an instance of Base.OneTo
or StaticOneTo
, depending on the type of n
.
StaticThings.maybestatic_reshape
— Functionmaybestatic_reshape(A, sz)
Reshapes array A
to sizes sz
.
If A
is a static array and sz
is static, the result is a static array.
StaticThings.maybestatic_size
— Functionmaybestatic_size(x)
Returns the size of x
as a tuple of dynamic or static integers.
StaticThings.size2axes
— Functionsize2axes(sz::Tuple)
size2axes(sz::StaticArrays.Size)
Get one-based indexing axes from a size of a collection-like object.
StaticThings.size2length
— Functionsize2length(sz::Tuple)
size2length(sz::StaticArrays.Size)
Get a length from a size (tuple).
StaticThings.size_from_type
— Functionsize_from_type(::Type{T})::StaticThings.SizeLike
Get the size (equivalent of StaticThings.maybestatic_size) of values of type T
.
Requires values of type T
to have a fixed known size, returns StaticThings.NoTypeSize{T}()
otherwise.
StaticThings.staticarray_type
— Functionstaticarray_type(T, sz::StaticArrays.Size)
Returns the type of a static array with element type T
and size sz
.