You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could one prefer const/static forms when they exist?
As a type level example, if T could be converted to 'static then Cow<'a,T> should be replaced by Cow<'static,T>.
As a value level, both Cow::Owned(Box<[T]>) and Cow::Borrowed(&'a [T]) should be replaced by Cow::Borrowed(&'static [T]).
There might exist users who'd wish to forbid allocations like Vec<T> etc. entirely too, but almost anyone using uneval should replace String with Cow<'static,str> and replace Vec<T> with Cow<'static,[T]>.
The text was updated successfully, but these errors were encountered:
I learned about this create from https://users.rust-lang.org/t/ron-are-there-crates-to-serialize-rust-types-as-correctly-formated-rust-code/55451
Could one prefer const/static forms when they exist?
As a type level example, if
T
could be converted to'static
thenCow<'a,T>
should be replaced byCow<'static,T>
.As a value level, both
Cow::Owned(Box<[T]>)
andCow::Borrowed(&'a [T])
should be replaced byCow::Borrowed(&'static [T]).
There might exist users who'd wish to forbid allocations like
Vec<T>
etc. entirely too, but almost anyone using uneval should replaceString
withCow<'static,str>
and replaceVec<T>
withCow<'static,[T]>
.The text was updated successfully, but these errors were encountered: