« first day (2565 days earlier)      last day (907 days later) » 

12:37 PM
How to write a function that can accept a string or a slice of string as an argument?

I tried fn random_func(str: &String | &str) -> String {
}

is this correct?
 
no...
Depending on what you need, you may use AsRef<str> or Into<String>
For example
fn random_func<S:AsRef<str>>(str: S) -> String {
Here you'll find two functions, one taking AsRef<str> and one taking Into<String> : github.com/Canop/minimad/blob/master/src/template/…
 
 
8 hours later…
9:05 PM
github.com/google/integers safe integers? in C++?? (actually inspired by Rust! lol)
 
like every in C++ since 5 years ?
CHEH
 
9:43 PM
Op wine, comment to explain, more wine, more wine more wine
I said I give up bye
OP add mcve
2 minutes after, OP delete question
how surprising
> Because people don't know how to search for things on the internet or don't realise that sometimes a minimal example wouldn't add anything I'm adding this stackoverflow.com/revisions/69668892/5
self burn
 
 
2 hours later…
11:23 PM
its a shame it ended in frustration because it looks like OP's problem could be remedied by fully-qualified paths. i.e. #[derive(::serde::Deserialize, ::serde::Serialize)]
 
11:51 PM
when compiler troll us: error[E0283]: type annotations needed => error[E0632]: cannot provide explicit generic arguments when impl Trait` is used in argument position`
@kmdreko I also propose him this
 

« first day (2565 days earlier)      last day (907 days later) »