Debian Codegraph @

src/shared/util/array_str.rs

raw symbols SCIP
1 // auto-generated by: jiff-cli generate shared
2
3 /// A simple and not the most-efficient fixed size string on the stack.
4 ///
5 /// This supplanted some uses of `Box<str>` for storing tiny strings in an
6 /// effort to reduce our dependence on dynamic memory allocation.
7 ///
8 /// Also, since it isn't needed and it lets us save on storage requirements,
9 /// `N` must be less than `256` (so that the length can fit in a `u8`).
10 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)]
11 #[doc(hidden)] // not part of Jiff's public API
12 pub struct ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<const N: usize> {
13 /// The UTF-8 bytes that make up the string.
14 ///
15 /// This array---the entire array---is always valid UTF-8. And
16 /// the `0..self.len` sub-slice is also always valid UTF-8.
17 bytesrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#bytes.: [u8; N],
18 /// The number of bytes used by the string in `bytes`.
19 ///
20 /// (We could technically save this byte in some cases and use a NUL
21 /// terminator. For example, since we don't permit NUL bytes in POSIX time
22 /// zone abbreviation strings, but this is simpler and only one byte and
23 /// generalizes. And we're not really trying to micro-optimize the storage
24 /// requirements when we use these array strings. Or at least, I don't know
25 /// of a reason to.)
26 lenrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#len.: u8,
27 }
28
29 impl<const N: usize> ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
30 /// Creates a new fixed capacity string.
31 ///
32 /// If the given string exceeds `N` bytes, then this returns
33 /// `None`.
34 pub(craterust-analyzer cargo jiff-static 0.2.16 crate/) const fn newrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]new().(s: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N>> {
35 let len = s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().();
36 if len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().N {
37 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
38 }
39 let mut bytes = [0; N];
40 let mut i = 0;
41 while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().().lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
42 bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
43 i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
44 }
45 // OK because we don't ever use anything bigger than u8::MAX for `N`.
46 // And we probably shouldn't, because that would be a pretty chunky
47 // array. If such a thing is needed, please file an issue to discuss.
48 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(N <= u8::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]MAX. as usize, "size of ArrayStr is too big");
49 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr# { bytesrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#bytes., lenrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#len.: len as u8 })
50 }
51
52 /// Returns the capacity of this array string.
53 pub(craterust-analyzer cargo jiff-static 0.2.16 crate/) fn capacityrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]capacity().() -> usize {
54 N
55 }
56
57 /// Append the bytes given to the end of this string.
58 ///
59 /// If the capacity would be exceeded, then this is a no-op and `false`
60 /// is returned.
61 pub(craterust-analyzer cargo jiff-static 0.2.16 crate/) fn push_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]push_str().(&mut self, s: &str) -> bool {
62 let len = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(self.lenrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#len.);
63 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_len) = len.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()) else { return false };
64 if new_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().N {
65 return false;
66 }
67 self.bytesrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#bytes.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().len..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#new_len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()..copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().());
68 // OK because we don't ever use anything bigger than u8::MAX for `N`.
69 // And we probably shouldn't, because that would be a pretty chunky
70 // array. If such a thing is needed, please file an issue to discuss.
71 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(
72 N <= usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(u8::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]MAX.),
73 "size of ArrayStr is too big"
74 );
75 self.lenrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#len. = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[u8][`TryFrom<usize>`]try_from().(new_len).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
76 true
77 }
78
79 /// Returns this array string as a string slice.
80 pub(craterust-analyzer cargo jiff-static 0.2.16 crate/) fn as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().(&self) -> &str {
81 // OK because construction guarantees valid UTF-8.
82 //
83 // This is bullet proof enough to use unchecked `str` construction
84 // here, but I can't dream up of a benchmark where it matters.
85 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&self.bytesrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#bytes.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(self.lenrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#len.)]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
86 }
87 }
88
89 /// Easy construction of `ArrayStr` from `&'static str`.
90 ///
91 /// We specifically limit to `&'static str` to approximate string literals.
92 /// This prevents most cases of accidentally creating a non-string literal
93 /// that panics if the string is too big.
94 ///
95 /// This impl primarily exists to make writing tests more convenient.
96 impl<const N: usize> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'static str> for ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
97 fn fromrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`][`From<&'static str>`]from().(s: &'static str) -> ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
98 ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#::newrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]new().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
99 }
100 }
101
102 impl<const N: usize> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<str> for ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
103 fn eqrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`][`PartialEq<str>`]eq().(&self, rhs: &str) -> bool {
104 self.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().rhs
105 }
106 }
107
108 impl<const N: usize> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<&str> for ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
109 fn eqrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`][`PartialEq<&str>`]eq().(&self, rhs: &&str) -> bool {
110 self.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().rhs
111 }
112 }
113
114 impl<const N: usize> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N>> for str {
115 fn eqrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[str][`PartialEq<ArrayStr<N>>`]eq().(&self, rhs: &ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N>) -> bool {
116 self rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().rhs.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().()
117 }
118 }
119
120 impl<const N: usize> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
121 fn fmtrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`][Debug]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
122 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[str][Debug]fmt().(self.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().(), f)
123 }
124 }
125
126 impl<const N: usize> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
127 fn fmtrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
128 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[str][Display]fmt().(self.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().(), f)
129 }
130 }
131
132 impl<const N: usize> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write# for ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
133 fn write_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`][Write]write_str().(&mut self, s: &str) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
134 if self.push_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]push_str().(s) {
135 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
136 } else {
137 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Error#)
138 }
139 }
140 }
141
142 impl<const N: usize> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str> for ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<N> {
143 fn as_refrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`][`AsRef<str>`]as_ref().(&self) -> &str {
144 self.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().()
145 }
146 }
147
148 /// A self-imposed limit on the size of a time zone abbreviation, in bytes.
149 ///
150 /// POSIX says this:
151 ///
152 /// > Indicate no less than three, nor more than {TZNAME_MAX}, bytes that are
153 /// > the designation for the standard (std) or the alternative (dst -such as
154 /// > Daylight Savings Time) timezone.
155 ///
156 /// But it doesn't seem worth the trouble to query `TZNAME_MAX`. Interestingly,
157 /// IANA says:
158 ///
159 /// > are 3 or more characters specifying the standard and daylight saving time
160 /// > (DST) zone abbreviations
161 ///
162 /// Which implies that IANA thinks there is no limit. But that seems unwise.
163 /// Moreover, in practice, it seems like the `date` utility supports fairly
164 /// long abbreviations. On my mac (so, BSD `date` as I understand it):
165 ///
166 /// ```text
167 /// $ TZ=ZZZ5YYYYYYYYYYYYYYYYYYYYY date
168 /// Sun Mar 17 20:05:58 YYYYYYYYYYYYYYYYYYYYY 2024
169 /// ```
170 ///
171 /// And on my Linux machine (so, GNU `date`):
172 ///
173 /// ```text
174 /// $ TZ=ZZZ5YYYYYYYYYYYYYYYYYYYYY date
175 /// Sun Mar 17 08:05:36 PM YYYYYYYYYYYYYYYYYYYYY 2024
176 /// ```
177 ///
178 /// I don't know exactly what limit these programs use, but 30 seems good
179 /// enough?
180 ///
181 /// (Previously, I had been using 255 and stuffing the string in a `Box<str>`.
182 /// But as part of work on [#168], I was looking to remove allocation from as
183 /// many places as possible. And this was one candidate. But making room on the
184 /// stack for 255 byte abbreviations seemed gratuitous. So I picked something
185 /// smaller. If we come across an abbreviation bigger than this max, then we'll
186 /// error.)
187 ///
188 /// [#168]: https://github.com/BurntSushi/jiff/issues/168
189 const ABBREVIATION_MAXrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ABBREVIATION_MAX.: usize = 30;
190
191 /// A type alias for centralizing the definition of a time zone abbreviation.
192 ///
193 /// Basically, this creates one single coherent place where we control the
194 /// length of a time zone abbreviation.
195 #[doc(hidden)] // not part of Jiff's public API
196 pub type Abbreviationrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/Abbreviation# = ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#<ABBREVIATION_MAXrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ABBREVIATION_MAX.>;
197
198 #[cfg(test)]
199 mod testsrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/tests/ {
200 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#;
201
202 use superrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/::*;
203
204 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
205 fn fmt_writerust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/tests/fmt_write().() {
206 let mut dst = ArrayStrrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/ArrayStr#::<5>::newrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]new().("").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
207 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(&mut dst, "abcd").is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
208 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(&mut dst, "e").is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
209 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(&mut dst, "f").is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
210 }
211 }