diff --git a/src/biosequence/printing.jl b/src/biosequence/printing.jl index a6dee497..eb6665bb 100644 --- a/src/biosequence/printing.jl +++ b/src/biosequence/printing.jl @@ -8,13 +8,13 @@ Base.summary(seq::BioSequence{<:AminoAcidAlphabet}) = string(length(seq), "aa ", # Buffer type. Not exposed to user, so code should be kept simple and performant. # B is true if it is buffered and false if it is not mutable struct SimpleBuffer{B, T} <: IO + const io::T + const arr::Vector{UInt8} len::UInt - arr::Vector{UInt8} - io::T end -SimpleBuffer(io::IO) = SimpleBuffer{true, typeof(io)}(0, Vector{UInt8}(undef, 1024), io) -SimpleBuffer(io::IO, len) = SimpleBuffer{false, typeof(io)}(0, Vector{UInt8}(undef, len), io) +SimpleBuffer(io::IO) = SimpleBuffer{true, typeof(io)}(io, Vector{UInt8}(undef, 1024), 0) +SimpleBuffer(io::IO, len) = SimpleBuffer{false, typeof(io)}(io, Vector{UInt8}(undef, len), 0) function Base.write(sb::SimpleBuffer{true}, byte::UInt8) sb.len ≥ 1024 && flush(sb) diff --git a/src/longsequences/longsequence.jl b/src/longsequences/longsequence.jl index b80d933b..e18f997b 100644 --- a/src/longsequences/longsequence.jl +++ b/src/longsequences/longsequence.jl @@ -84,7 +84,7 @@ The same applies with `LongSequence{RNAAlphabet{4}}`, simply replace the alphabe parameter with `RNAAlphabet{2}` in order to benefit. """ mutable struct LongSequence{A <: Alphabet} <: BioSequence{A} - data::Vector{UInt64} # encoded character sequence data + const data::Vector{UInt64} # encoded character sequence data len::UInt function LongSequence{A}(data::Vector{UInt64}, len::UInt) where {A <: Alphabet} diff --git a/src/search/re.jl b/src/search/re.jl index 12521c55..ef17e3e7 100644 --- a/src/search/re.jl +++ b/src/search/re.jl @@ -51,8 +51,8 @@ import BioSequences # ----------- mutable struct SyntaxTree - head::Symbol - args::Vector{Any} + const head::Symbol + const args::Vector{Any} function SyntaxTree(head, args) @assert head ∈ ( @@ -805,11 +805,11 @@ end # simple stack mutable struct Stack{T} + const data::Vector{T} top::Int - data::Vector{T} function Stack{T}(sz::Int=0) where T - return new{T}(0, Vector{T}(undef, sz)) + return new{T}(Vector{T}(undef, sz), 0) end end