00:21 <+bridge> [ddnet] https://media.discordapp.net/attachments/557260368867622932/1017820535616458772/unknown.png 00:30 <+bridge> [ddnet] It's mind boggling how annoying implementing a parser for a custom type is in clap 00:31 <+bridge> [ddnet] @Learath2 are you using the derive method of using clap? 00:31 <+bridge> [ddnet] with that one it was much easier for me 00:31 <+bridge> [ddnet] I was using the builder method 00:32 <+bridge> [ddnet] How do you ever return a proper error from your custom parser? 00:33 <+bridge> [ddnet] ``` 00:33 <+bridge> [ddnet] fn parse_tuple( 00:33 <+bridge> [ddnet] s: &str, 00:33 <+bridge> [ddnet] ) -> Result<(T, T), Box> 00:33 <+bridge> [ddnet] where 00:33 <+bridge> [ddnet] T::Err: Error + Send + Sync + 'static, 00:33 <+bridge> [ddnet] { 00:33 <+bridge> [ddnet] if s.matches(SEPARATOR).count() != 1 { 00:33 <+bridge> [ddnet] return Err(format!("Expected 2 values separated by '{}'", SEPARATOR).into()); 00:33 <+bridge> [ddnet] } 00:33 <+bridge> [ddnet] let mut values = s.split(SEPARATOR).map(|str| str.parse::()); 00:33 <+bridge> [ddnet] Ok((values.next().unwrap()?, values.next().unwrap()?)) 00:33 <+bridge> [ddnet] } 00:33 <+bridge> [ddnet] ``` 00:33 <+bridge> [ddnet] ```rs 00:33 <+bridge> [ddnet] #[clap(long, short = 'p', value_parser = parse_tuple::)] 00:33 <+bridge> [ddnet] position: Vec<(f32, f32)>, 00:33 <+bridge> [ddnet] ``` 00:33 <+bridge> [ddnet] thats all it takes with the derive method 00:34 <+bridge> [ddnet] (from one of my twgpu tools) 00:35 <+bridge> [ddnet] without the derive method it was a lot of hassle and at the end I didn't even have the clap coloring in my error. this way everything just worked 00:36 <+bridge> [ddnet] I think I'll just try another library 00:36 <+bridge> [ddnet] I'm just very annoyed at it making something so trivial so long and insufferable 00:37 <+bridge> [ddnet] yeah :/ 00:37 <+bridge> [ddnet] but now that the derive thingy is integrated into the clap crate directly, I liked it 00:38 <+bridge> [ddnet] But then I have to use the weird one off struct way of getting arguments which just feels wrong 00:42 <+bridge> [ddnet] apart from a little weird first it is also very darn simple :p 00:42 <+bridge> [ddnet] and having it as an explicit type also gave the certainty that I didn't mess up some parameters somewhere 00:42 <+bridge> [ddnet] I'm very much considering just calling out to getopt, that's how annoyed I am at wasting half an hour trying to parse a stupid uri properly 00:44 <+bridge> [ddnet] Okay, one last try, I'll give it a go with the derive version 01:06 <+bridge> [ddnet] ``` = note: expected trait `for<'r> fn(&'r str) -> Result, URIError> {parse_url} as FnOnce<(&'r str,)>>` 01:06 <+bridge> [ddnet] found trait `for<'r> fn(&'r str) -> Result, URIError> {parse_url} as FnOnce<(&'r str,)>>` 01:06 <+bridge> [ddnet] ``` 01:06 <+bridge> [ddnet] I think this is enough rust for one night 01:06 <+bridge> [ddnet] The compiler seems to be smoking something 01:06 <+bridge> [ddnet] I see no difference? 01:07 <+bridge> [ddnet] neither 01:07 <+bridge> [ddnet] Neither do I 01:07 <+bridge> [ddnet] I think I got the lifetime wrong somehow 01:08 <+bridge> [ddnet] I see two `'r`s 01:11 <+bridge> [ddnet] I think it has sth to do with the weird way uriparse just doesn't have a version that takes ownership of the string 01:12 <+bridge> [ddnet] can you show the code line that produces it? 01:12 <+bridge> [ddnet] `#[derive(Parser, Debug)]` 01:14 <+bridge> [ddnet] probably also a URI member? 01:15 <+bridge> [ddnet] use the url crate 01:15 <+bridge> [ddnet] from mozilla 01:15 <+bridge> [ddnet] they use it 01:15 <+bridge> [ddnet] on firefox iirc 01:15 <+bridge> [ddnet] https://crates.io/crates/url 01:15 <+bridge> [ddnet] https://github.com/servo/rust-url 01:16 <+bridge> [ddnet] cant get better than this 01:17 <+bridge> [ddnet] I'm sure that'll work since it looks like it uses a clone of the string so it's lifetime doesn't look like it depends on the initial string 01:20 <+bridge> [ddnet] @heinrich5991 https://paste.pr0.tips/Wno 01:20 <+bridge> [ddnet] I just don't know how to tell the compiler that the argument will live long enough, any idea? 01:21 <+bridge> [ddnet] I'll just use mozilla's version, but at this point I'm just annoyed that it won't work 01:22 <+bridge> [ddnet] hm 01:22 <+bridge> [ddnet] just clone 01:22 <+bridge> [ddnet] ? 01:22 <+bridge> [ddnet] but why use urlparse 01:22 <+bridge> [ddnet] when url is better 01:23 <+bridge> [ddnet] It's a learning opportunity that's why. I'll use url just as soon as I figure out why on earth clap wants this struct to be 'static 01:24 <+bridge> [ddnet] probs because it wants the program options to live as long as the program 01:24 <+bridge> [ddnet] cloning doesn't work since URI has string references to the original string 01:25 <+bridge> [ddnet] The underlying OSString should live long enough for that 01:25 <+bridge> [ddnet] yes, a cloned one in the function on the other hand shouldn't 01:26 <+bridge> [ddnet] Hm, maybe the intermediate &str clap creates just doesn't live long enough 01:26 <+bridge> [ddnet] fn parse_url(value: &'static str) -> Result { 01:26 <+bridge> [ddnet] URI::try_from(value) 01:26 <+bridge> [ddnet] } 01:26 <+bridge> [ddnet] then 01:26 <+bridge> [ddnet] clap will never 01:26 <+bridge> [ddnet] make a 'static str 01:26 <+bridge> [ddnet] from command line options 01:26 <+bridge> [ddnet] 'static str are strs that are in the binary itself mostly 01:27 <+bridge> [ddnet] or String ones 01:27 <+bridge> [ddnet] I tried that ```note: `fn(&'static str) -> Result, URIError> {parse_url}` must implement `FnOnce<(&'0 str,)>`, for any lifetime `'0`...``` 01:28 <+bridge> [ddnet] does clap::value_parser!(URI) 01:28 <+bridge> [ddnet] work? 01:28 <+bridge> [ddnet] xD 01:28 <+bridge> [ddnet] Ofc not, I'm not retarded 01:28 <+bridge> [ddnet] https://docs.rs/clap/latest/clap/builder/trait.ValueParserFactory.html 01:29 <+bridge> [ddnet] URI is not FromStr so it doesn't work 01:29 <+bridge> [ddnet] god 01:29 <+bridge> [ddnet] ur using a crate from 6 years ago 01:30 <+bridge> [ddnet] Anyway, I understand the limitations of this library now. Why I expected a 700kb library to be conscious of the amount of times it forces you to copy shit around is beyond me 01:30 <+bridge> [ddnet] I'll just copy it like a good boy 01:30 <+bridge> [ddnet] oh 01:30 <+bridge> [ddnet] 6 months 01:30 <+bridge> [ddnet] i was looking at the wrong one 01:30 <+bridge> [ddnet] i think u just 01:30 <+bridge> [ddnet] dont understnad what ur doing 01:30 <+bridge> [ddnet] thats why 01:31 <+bridge> [ddnet] I'm extremely sure stuff in argv lives way past the programs puny lifetime 01:32 <+bridge> [ddnet] okay 01:32 <+bridge> [ddnet] u made me create this project 01:32 <+bridge> [ddnet] let me see 01:32 <+bridge> [ddnet] i shouldnt do this while being half drunk 01:33 <+bridge> [ddnet] It's probably not possible due to the way rust handles OsStrings without some platform dependent code, thus I'm guessing clap just creates a utf8 version of it during parse time which you are supposed to store yourself 01:33 <+bridge> [ddnet] ostrings are no different than str 01:33 <+bridge> [ddnet] they just dont v alidate utf9 01:33 <+bridge> [ddnet] utf8 01:33 <+bridge> [ddnet] Actually they wouldn't even be utf8 on windows, they'd be utf16 or ucs2 01:33 <+bridge> [ddnet] yeah 01:34 <+bridge> [ddnet] they dont validate encoding iirc 01:34 <+bridge> [ddnet] or smth like that 01:34 <+bridge> [ddnet] since paths can be invalid utf8 01:39 <+bridge> [ddnet] Anyway, even all the way at std::env::ArgsOs I'm getting an OsString not an OsStr. It's not a reference to begin with, so no point messing around with this 01:40 <+bridge> [ddnet] OsString is owned 01:40 <+bridge> [ddnet] so it can live as long as you want 01:41 <+bridge> [ddnet] But I have to put it somewhere. The actual underlying string that's part of argv already lives long enough. I just thought a reference to that would be accessible 01:41 <+bridge> [ddnet] That doesn't seem to be the case 01:41 <+bridge> [ddnet] honestly 01:41 <+bridge> [ddnet] if you ask me 01:41 <+bridge> [ddnet] your args should just be 01:41 <+bridge> [ddnet] String or PathBufs 01:41 <+bridge> [ddnet] and then u validate them 01:41 <+bridge> [ddnet] converting them to parsed urls 01:41 <+bridge> [ddnet] and returning errors otherwise 01:42 <+bridge> [ddnet] i recommend color_eyre 01:42 <+bridge> [ddnet] for error reporting 01:42 <+bridge> [ddnet] I'm being punished for wanting nicely formatted errors that match with claps 01:42 <+bridge> [ddnet] ur not 01:42 <+bridge> [ddnet] claps is not a error reporting tool 01:42 <+bridge> [ddnet] it just parses args 01:42 <+bridge> [ddnet] idk why uriparser 01:42 <+bridge> [ddnet] doesnt implement fromstr 01:42 <+bridge> [ddnet] they should 01:42 <+bridge> [ddnet] they are stupid 01:43 <+bridge> [ddnet] so u can implement it urself 01:43 <+bridge> [ddnet] or use url from mozilla 01:43 <+bridge> [ddnet] they know better 01:43 <+bridge> [ddnet] Which does include validation in my opinion and given clap implements some validation they seem to atleast semi agree with me 01:44 <+bridge> [ddnet] look 01:44 <+bridge> [ddnet] https://cdn.discordapp.com/attachments/293493549758939136/1017943692234989568/unknown.png 01:44 <+bridge> [ddnet] url from mozzilla 01:44 <+bridge> [ddnet] works out of the box 01:44 <+bridge> [ddnet] its insane right? 01:45 <+bridge> [ddnet] ```rust 01:45 <+bridge> [ddnet] use clap::Parser; 01:45 <+bridge> [ddnet] 01:45 <+bridge> [ddnet] #[derive(Parser, Debug)] 01:45 <+bridge> [ddnet] #[clap( 01:45 <+bridge> [ddnet] version = "0.0.1", 01:45 <+bridge> [ddnet] about = "Provides bans to a compatible teeworlds server or proxy instance" 01:45 <+bridge> [ddnet] )] 01:45 <+bridge> [ddnet] struct Args { 01:45 <+bridge> [ddnet] #[clap(short = 't', long)] 01:45 <+bridge> [ddnet] auth_token: String, 01:45 <+bridge> [ddnet] 01:45 <+bridge> [ddnet] #[clap(short, long)] 01:45 <+bridge> [ddnet] bindaddrs: Vec, 01:45 <+bridge> [ddnet] } 01:45 <+bridge> [ddnet] 01:45 <+bridge> [ddnet] fn main() { 01:45 <+bridge> [ddnet] let args = Args::parse(); 01:45 <+bridge> [ddnet] dbg!(args); 01:45 <+bridge> [ddnet] } 01:45 <+bridge> [ddnet] ``` 01:45 <+bridge> [ddnet] uriparser is just badly done 01:45 <+bridge> [ddnet] they suck 01:45 <+bridge> [ddnet] end of story 01:45 <+bridge> [ddnet] Yes bossman, if you copy, it works just fine on it's own 01:46 <+bridge> [ddnet] you rly want to optimize a copy done 1 time at the program init 01:46 <+bridge> [ddnet] well you go for it 01:46 <+bridge> [ddnet] i may figure it out tomorrow with a clear mind 01:46 <+bridge> [ddnet] but not rn xd 01:47 <+bridge> [ddnet] also vec needs to allocate always 01:47 <+bridge> [ddnet] no matter what 01:48 <+bridge> [ddnet] Yes it's premature optimization, I already said I'll use a copy aswell. Why is me being curious about a tiny optimization so offensive to you? 01:48 <+bridge> [ddnet] idk 01:48 <+bridge> [ddnet] its just me 01:48 <+bridge> [ddnet] im a bit annoyed cuz other reasons 01:48 <+bridge> [ddnet] dont mind me 01:54 <+bridge> [ddnet] i looked a bit 01:54 <+bridge> [ddnet] i dont think clap does zero cost parsing rn 01:54 <+bridge> [ddnet] it needs owned values 01:54 <+bridge> [ddnet] Grab a $750 Paypal Gift Card Now!Here is a $750 free paypal gift card for you.Don't missit.if don't belive,you can come back.Trust me.Here is all details .If you click here..πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡Click Link \: https://t.me/+_JdxukNCoaVmMWFkTelegram\:@DONALDBAILEY12 01:54 <+bridge> [ddnet] 01:55 <+bridge> [ddnet] @DONALDBAILEY12 02:16 <+bridge> [ddnet] Thanks for looking into it 02:41 <+bridge> [ddnet] https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain_filter 😦 02:41 <+bridge> [ddnet] Why are all the cool things experimental? 08:56 <+bridge> [ddnet] Grab a $750 Paypal Gift Card Now!Here is a $750 free paypal gift card for you.Don't missit.if don't belive,you can come back.Trust me.Here is all details .If you click here..πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡Click Link \: https://t.me/+_JdxukNCoaVmMWFkTelegram\:@DONALDBAILEY12 08:56 <+bridge> [ddnet] 08:56 <+bridge> [ddnet] @DONALDBAILEY12 10:38 <+bridge> [ddnet] https://doc.rust-lang.org/std/vec/struct.Vec.html#method.retain might also do what you want? 11:42 <+bridge> [ddnet] Idk why i can chat here 11:42 <+bridge> [ddnet] Fix this 11:58 <+bridge> [ddnet] that's how the language is developed. things in the standard library are supposed to work forever, this is how they're tried before they become stable 12:28 <+bridge> [ddnet] I want the stuff that gets removed too 12:30 <+bridge> [ddnet] Something like std::future would be cool. You let the user know that the feature might stop working or be removed, but they dont have to use nightly while people chat about how to name the feature for 5 years 12:32 <+bridge> [ddnet] @Learath2 use some polyfill: https://lib.rs/crates/vec-drain-where 12:33 <+bridge> [ddnet] or rather this, for a precise polyfill: https://lib.rs/crates/drain_filter_polyfill 12:33 <+bridge> [ddnet] (the latter being simply copy-pasted out of the standard library) 12:34 <+bridge> [ddnet] (according to the docs] 12:34 <+bridge> [ddnet] (according to the docs) 12:34 <+bridge> [ddnet] That's a good idea actually 12:35 <+bridge> [ddnet] Given this kind of thing exists maybe they should just do it within std so people dont have to make a new crate each time 12:35 <+bridge> [ddnet] making a crate each time means that the backward compatibility promise is kept 12:36 <+bridge> [ddnet] the polyfill will keep working 12:36 <+bridge> [ddnet] even if the thing isn't added 12:38 <+bridge> [ddnet] Hm, I guess leaving it out of std jn thay case makes sure that std just doesnt grow forever full of old features that never got added 12:39 <+bridge> [ddnet] I'm still very skeptical of this backwards compatibility must last forever approach to language development 12:39 <+bridge> [ddnet] I like keeping breakage low 12:40 <+bridge> [ddnet] my pre-1.0 project had to be adjusted to work with 1.0 12:40 <+bridge> [ddnet] I don't think I'd have done it if I knew that I'd have to keep fixing it 12:40 <+bridge> [ddnet] Low is nice. Never is way too strict. Old projects should be compiled with old compilers 12:40 <+bridge> [ddnet] check the compatibility guidelines. they don't promise "never" 12:41 <+bridge> [ddnet] in fact, we got a new borrow checker for example 12:41 <+bridge> [ddnet] it rejects some old incorrect code and some old correct code. but both were rare 12:42 <+bridge> [ddnet] https://blog.rust-lang.org/2014/10/30/Stability.html#what-are-the-stability-caveats 12:42 <+bridge> [ddnet] e.g. this 12:42 <+bridge> [ddnet] > We reserve the right to fix compiler bugs, patch safety holes, and change type inference in ways that may occasionally require new type annotations. We do not expect any of these changes to cause headaches when upgrading Rust. 12:42 <+bridge> [ddnet] > 12:42 <+bridge> [ddnet] > The library API caveats will be laid out in a forthcoming RFC, but are similarly designed to minimize upgrade pain in practice. 12:44 <+bridge> [ddnet] there's e.g. some discussion about how to deal with `std::env::set_env`, which is probably impossible to make safe and keep its current functionality 12:44 <+bridge> [ddnet] https://github.com/rust-lang/rust/issues/90308 12:53 <+bridge> [ddnet] Tbf I think the answer is clear here. set_env should definitely be marked unsafe. I don't even know any OS that has a threadsafe version of setenv 13:36 <+bridge> [ddnet] @Learath2 probably windows 13:49 <+bridge> [ddnet] I didn't see any guarantee on the winapi documentation, but I wouldnt be surprised. Microsoft does have a lot more locking in their apis 13:50 <+bridge> [ddnet] I wonder how this issue never came up in POSIX 15:41 <+bridge> [ddnet] omg i love you 15:48 <+bridge> [ddnet] I can't load the map preview for maps with # in their names (tested for #wontfix and Bootcamp #1, Stronghold worked) https://ddnet.tw/maps/Bootcamp-32--35-1 15:48 <+bridge> [ddnet] https://github.com/ddnet/ddnet/issues/1 15:49 <+bridge> [ddnet] developer tools show an improperly escaped map file name 15:49 <+bridge> [ddnet] I also didn't manage to get a working download link in the shape of https://ddnet.tw/mappreview/mapname.map 15:49 <+bridge> [ddnet] `https://ddnet.tw/mappreview/Bootcamp%20#1.map` 15:50 <+bridge> [ddnet] the # is interpreted as anchor, so `https://ddnet.tw/mappreview/Bootcamp` is requested 15:50 <+bridge> [ddnet] the script is broken 15:50 <+bridge> [ddnet] the link you sent also doesn't work for me (if it should've) 15:50 <+bridge> [ddnet] ah 15:50 <+bridge> [ddnet] yea 15:50 <+bridge> [ddnet] that's the broken link 15:50 <+bridge> [ddnet] https://ddnet.tw/mappreview/Bootcamp%20%231.map 15:50 <+bridge> [ddnet] this would be the correct link 15:51 <+bridge> [ddnet] idk, report a bug 16:19 <+bridge> [ddnet] I seem to have managed to lose all my problem solving skills by not coding almost anything for 2 years 16:36 <+bridge> [ddnet] F 16:36 <+bridge> [ddnet] thats why u gotta keep doing it 16:36 <+bridge> [ddnet] even if little 16:36 <+bridge> [ddnet] well having a job related helps xd 17:01 <+bridge> [ddnet] problem solving doesn't require coding, it requires thinking πŸ™‚ 17:04 <+bridge> [ddnet] damn 17:10 <+bridge> [ddnet] 17:11 <+bridge> [ddnet] im not good at either of those 17:36 <+bridge> [ddnet] I haven't been thinking either for 2 years 17:36 <+bridge> [ddnet] I've been sitting around waiting to rot 17:37 <+bridge> [ddnet] you have been thinking, you're just trapped in your depression 20:20 <+bridge> [ddnet] `51.68.87.73:56051` 20:20 <+bridge> [ddnet] Fake KoG server 20:20 <+bridge> [ddnet] now faking DDNet 20:21 <+bridge> [ddnet] now server name includes BlmapChill 20:21 <+bridge> [ddnet] its a scuffed server 20:21 <+bridge> [ddnet] to attract player ips 20:21 <+bridge> [ddnet] probably vali 20:21 <+bridge> [ddnet] @deen 20:21 <+bridge> [ddnet] ⚠️ 20:22 <+bridge> [ddnet] it changes server name very often, should get banned probably 22:04 <+bridge> [ddnet] @heinrich5991 hey, there's lots of servers to masterban (fake fokkonaut, cf @fokkonaut ) 22:15 <+bridge> [ddnet] IP collector animals :poggers2: 22:18 <+bridge> [ddnet] yeah he's having fun lmao 22:18 <+bridge> [ddnet] It can be annoying for both sites 22:18 <+bridge> [ddnet] why 22:46 <+bridge> [ddnet] Play some puzzle games, baba is you is very good 23:09 <+bridge> [ddnet] <৳ NeurOnuS け> Is it necessary to use update.json to add Serverlist? 23:09 <+bridge> [ddnet] <৳ NeurOnuS け> #developer ' 23:10 <+bridge> [ddnet] <৳ NeurOnuS け> @Chairn@Voxel 23:13 <+bridge> [ddnet] Why are you pinging me? 23:13 <+bridge> [ddnet] I rly dont know much yet 23:13 <+bridge> [ddnet] <৳ NeurOnuS け> for my question 23:13 <+bridge> [ddnet] <৳ NeurOnuS け> So why do you pretend to be a developer? @Voxel 23:26 <+bridge> [ddnet] im not pretending, i literally added a feature LOL 23:49 <+bridge> [ddnet] done