File tree Expand file tree Collapse file tree 4 files changed +5
-3
lines changed
Expand file tree Collapse file tree 4 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ def copySlice (src : @& ByteArray) (srcOff : Nat) (dest : ByteArray) (destOff le
8787def extract (a : ByteArray) (b e : Nat) : ByteArray :=
8888 a.copySlice b empty 0 (e - b)
8989
90+ @[inline]
9091protected def fastAppend (a : ByteArray) (b : ByteArray) : ByteArray :=
9192 -- we assume that `append`s may be repeated, so use asymptotic growing; use `copySlice` directly to customize
9293 b.copySlice 0 a a.size b.size false
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ Examples:
160160 * `"" ++ "" = ""`
161161 -/
162162@[extern "lean_string_append", expose]
163- def String.append (s t : String) : String where
163+ def String.append (s : String) ( t : @& String) : String where
164164 bytes := s.bytes ++ t.bytes
165165 isValidUtf8 := s.isValidUtf8.append t.isValidUtf8
166166
@@ -221,7 +221,7 @@ Examples:
221221* `"L∃∀N".length = 4`
222222 -/
223223@[extern "lean_string_length"]
224- def String.length (b : String) : Nat :=
224+ def String.length (b : @& String) : Nat :=
225225 b.data.length
226226
227227@[simp]
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ Examples:
141141 * `[].asString = ""`
142142 * `['a', 'a', 'a'].asString = "aaa"`
143143 -/
144- @[expose]
144+ @[expose, inline ]
145145def List.asString (s : List Char) : String :=
146146 String.mk s
147147
Original file line number Diff line number Diff line change @@ -1177,6 +1177,7 @@ public theorem ByteArray.isSome_utf8DecodeChar?_append {b : ByteArray} {i : Nat}
11771177 obtain ⟨c, hc⟩ := Option.isSome_iff_exists.1 h
11781178 rw [utf8DecodeChar?_append_eq_some hc, Option.isSome_some]
11791179
1180+ @[inline]
11801181public def ByteArray.utf8DecodeChar (bytes : ByteArray) (i : Nat) (h : (utf8DecodeChar? bytes i).isSome) : Char :=
11811182 (utf8DecodeChar? bytes i).get h
11821183
You can’t perform that action at this time.
0 commit comments