From 20f125c3aa5836d0080fb03a556c2021448999e0 Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Tue, 4 Oct 2022 13:59:42 +0100 Subject: [PATCH] Simplify converting to Vector{UInt8} (#46) --- src/InlineStrings.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/InlineStrings.jl b/src/InlineStrings.jl index 2a1dd31..5956d47 100644 --- a/src/InlineStrings.jl +++ b/src/InlineStrings.jl @@ -132,6 +132,9 @@ function Base.Symbol(x::T) where {T <: InlineString} (Ref{T}, Int), ref, sizeof(x)) end +Base.Vector{UInt8}(s::InlineString) = Vector{UInt8}(codeunits(s)) +Base.Array{UInt8}(s::InlineString) = Vector{UInt8}(codeunits(s)) + # add a codeunit to end of string method function addcodeunit(x::T, b::UInt8) where {T <: InlineString} if T === InlineString1