Introduction
Introduction Statistics Contact Development Disclaimer Help
Post Ak0ntsT2tSiLdAO7hw by [email protected]
More posts by [email protected]
Post #AjsVZPDQbUKmC9UXgm by [email protected]
0 likes, 0 repeats
I'm writing rust without fully understanding the language. Pray for me.Actu…
Post #AjsVknGLXOA3xeHqFs by [email protected]
0 likes, 0 repeats
I just had to look up why "str" didn't work (I mean "String&…
Post #AjsVmwU6DpBl8okCem by [email protected]
0 likes, 0 repeats
@foone this is most people with most languagesthis is also why Amaranth is like…
Post #AjsWlPg6oFNx3iCEMq by [email protected]
0 likes, 0 repeats
@foone Oh god the rust string situation is admittedly crazy and I say this as a…
Post #AjsWlPm8RqCpMP12lE by [email protected]
0 likes, 0 repeats
@114N and I only know two! So many more string types to learn!
Post #AjsYshITtv8BddkIee by [email protected]
0 likes, 0 repeats
oh you have to define your return types. I didn't know that. I was returnin…
Post #AjsZ929e7YyExaP31U by [email protected]
0 likes, 0 repeats
wait is this function returning the Result that Some of it is Ok?
Post #AjsZTBk0BlBaU21Day by [email protected]
0 likes, 0 repeats
I'm not entirely sure I am sober enough to understand how Results interact …
Post #AjsZknvnS3T3qpw3aS by [email protected]
0 likes, 1 repeats
@foone this sounds like it's one step above "all functions return a js…
Post #AjsZmpvT0S4ScIkZZA by [email protected]
0 likes, 1 repeats
@foone Result and Option are enums, which unlike C enums can have parameters, e…
Post #Ajsa0OfFA3nk7WczXU by [email protected]
0 likes, 0 repeats
@foone Usually they don't interact.You use Options as function parameters a…
Post #Ajsa0OkuoyL2P7HWNc by [email protected]
0 likes, 1 repeats
@ospalh you might, but I don't think that's universal, insofar as plent…
Post #AjsaWJW7pjOXQKa9a4 by [email protected]
0 likes, 0 repeats
I think I understood that but now I'm trying to understand the anyhow crate…
Post #AjsbaGSHGAvf2VEJmK by [email protected]
0 likes, 1 repeats
@foone yes, anyhow allows you to add information to an error, so that rather th…
Post #AjsbcExhmYYgzIs8hc by [email protected]
0 likes, 0 repeats
oh, there's a foo() function returning anyhow::Result, so other code can do…
Post #AjsbkmBq7pBgMKYOg4 by [email protected]
0 likes, 0 repeats
and with_context() is anyhow::Result.with_context, and it returns itself. So yo…
Post #AjsdXZ11zmytdxKFzE by [email protected]
0 likes, 1 repeats
@foone Option represents "possibility of absence" and result is &quot…
Post #AjsdnUQKpsgE2FktxQ by [email protected]
0 likes, 1 repeats
@foone counter intuitive but often in rust the "verbose and correct thing&…
Post #AjsgpOGD1Oo3MUcJbE by [email protected]
0 likes, 0 repeats
the docs just told me I can manually customize my panic and I have very little …
Post #AjshendoPsLWqbAfM8 by [email protected]
0 likes, 1 repeats
@foone it's like building a Mii, but it's a crab.
Post #Ajsicz3L7If1cCoEdc by [email protected]
0 likes, 0 repeats
@foone if the doctors offered me the chance to customise my panic you best beli…
Post #Aju0zJ3NQc2eLka3Jw by [email protected]
0 likes, 0 repeats
ugh. I slept for like 9 hours and the Rust code is still here
Post #Aju189zoTOOgrg8SUC by [email protected]
0 likes, 0 repeats
and I still don't understand it
Post #Aju18Cg4VFO9BJvEdE by [email protected]
0 likes, 0 repeats
anyway the part of the puzzle that I think I inadvertently left out of this thr…
Post #Aju1PxwS1rgYgx3MWG by [email protected]
0 likes, 0 repeats
which is a lot easier when it's a word like "Result" or "any…
Post #Aju1Q0be7fpGxILI0W by [email protected]
0 likes, 0 repeats
(I think I figured out ? now, you don't need to provide any help. that was …
Post #Aju1d74nNVcQmqE2Ay by [email protected]
0 likes, 1 repeats
it's working and I am learning rust, it's just very much the same vibes…
Post #Aju1njqk4gwZw5icGO by [email protected]
0 likes, 0 repeats
@foone my feed is all full of the attempted assassination of Donald Trump and t…
Post #Aju1njwliHlSEmXQem by [email protected]
0 likes, 0 repeats
@immibis to be honest I'm over here on mastodon trying to figure out rust b…
Post #Aju1r4y01CkEIXhpoW by [email protected]
0 likes, 0 repeats
I should probably figure out what these & symbols mean
Post #Aju29vSBc0teIOoR1c by [email protected]
0 likes, 1 repeats
is there any ide that's recommended for doing rust? I'm currently just …
Post #Aju2qgtTcYu7aiyA76 by [email protected]
0 likes, 1 repeats
@foone i use kakoune and hoping to switch to helix soon, but if you're on W…
Post #Aju2rsdPSE1OIK1NLM by [email protected]
0 likes, 0 repeats
oh now now I have to understand how implementing iterators works
Post #Aju3ReIsDNUWGvTIGm by [email protected]
0 likes, 0 repeats
okay apparently the problem is that this code implements iterator for "foo…
Post #Aju3RgxiKVLeWAawCm by [email protected]
0 likes, 0 repeats
but I do like that it's "for more information, run "rustc --expla…
Post #Aju3RhkzNIlOyzeI0e by [email protected]
0 likes, 0 repeats
if you look closely you can spot where the article is supposed to be
Post #Aju4KVLzBvnORS5InY by [email protected]
0 likes, 1 repeats
@kmc Medium has a paywall?cc: @foone
Post #Aju5NqhgMxBTTqOKXI by [email protected]
0 likes, 0 repeats
@foone what r u cooking?
Post #Aju5Nqni0Y0LmXD8vg by [email protected]
0 likes, 0 repeats
@slonk I'm modifying someone else's code to parse a language I defined …
Post #Aju5NuTeL4KtBTrBDc by [email protected]
0 likes, 0 repeats
@foone I would sometimes like to be able to turn on something like “student�…
Post #Aju5NuZfyf9lUAfzc0 by [email protected]
0 likes, 0 repeats
@mhoye yeah, that'd be great! like a quick way to say "explain this li…
Post #Aju5v0HBnbdCj3oCga by [email protected]
0 likes, 0 repeats
type Item = &'a str;this is valid syntax and not someone sneezing into …
Post #Aju5v2y9mpBp4tvXw8 by [email protected]
0 likes, 0 repeats
okay I think the problem is something like: this code originally implemented In…
Post #Aju5v3l4qwJzWcocBk by [email protected]
0 likes, 0 repeats
now I gotta figure out what a tuple struct is.it seems to be a regular struct e…
Post #Aju5v4XdwNAZxFXOt6 by [email protected]
0 likes, 0 repeats
sometimes I worry I'm not awake & sober enough to understand this. some…
Post #Aju6T78SnqLbqSzbDk by [email protected]
0 likes, 0 repeats
@foone https://doc.rust-lang.org/stable/std/iter/index.html#implementing-iterat…
Post #Aju6T7EURRAU99oPc8 by [email protected]
0 likes, 0 repeats
@Jhynjhiruu yeah I'm heavily using the official docs and rust by example, I…
Post #Aju7W2Q0teyE2T9wsy by [email protected]
0 likes, 0 repeats
@foone I recently learned Rust and found the online 'Rust book' very us…
Post #Aju7W2VgYZVWK3oTj6 by [email protected]
0 likes, 0 repeats
@kevin yeah see that's the thing: I know enough vaguely similar languages t…
Post #Aju7eJBuQ9VINHVQci by [email protected]
0 likes, 0 repeats
@foone fwiw I also use Sublime but I use a combination of RustEnhanced (for bas…
Post #Aju7eJII2Qbkh4UWZM by [email protected]
0 likes, 0 repeats
@onelson ooh, handy. I'll have to look into that. Thanks!
Post #Aju8JGieW3KCa5Lvf6 by [email protected]
0 likes, 1 repeats
and someone mentioned cargo-mommy to me and now I'm having my brain broken …
Post #Aju8WyI7pLA1TxTkK8 by [email protected]
0 likes, 0 repeats
@gregly I should install a klingon module so instead of compile-success I get &…
Post #Aju8kFb2nYJ2uxeyZc by [email protected]
0 likes, 0 repeats
@foone isn't a tuple just an immutable list?
Post #Aju8kFgiSSqLCYJVPk by [email protected]
0 likes, 0 repeats
@canteen in python, sure. I think it's pretty similar in rust, but there&#3…
Post #Aju9clEvMiwuh9J2MC by [email protected]
0 likes, 0 repeats
okay, enough people being horny about programming languages and shooting at for…
Post #Aju9lv625XKfs3VxM8 by [email protected]
0 likes, 1 repeats
@foone For the rare occasions I work with rust, it's via JetBrains' Rus…
Post #Aju9mDw62hfqIk0n0S by [email protected]
0 likes, 0 repeats
so (and I'm writing this primarily to rubber-duck my own understanding of i…
Post #Aju9mGci3EwsdTxqhk by [email protected]
0 likes, 0 repeats
originally this code had the IntoIterator trait implemented, but that doesn&#3…
Post #AjuAA0VVcdpFbPusqW by [email protected]
0 likes, 0 repeats
because defining an iterator (or IntoIterator) for Commands is different than d…
Post #AjuAA3BPfoX7txXNRI by [email protected]
0 likes, 0 repeats
so... presumably I need to implement an iterator/IntoIterator for &Commands…
Post #AjuAo11r6NGwnu7jZg by [email protected]
0 likes, 1 repeats
@foone its entirely probable you could do impl IntoIterator for &Commands; …
Post #AjuBBMDaUFRHBJk2Fs by [email protected]
0 likes, 0 repeats
"in the trait associated type is declared without lifetime parameters, so …
Post #AjuBDxLdPUXUutkEeO by [email protected]
0 likes, 1 repeats
@foone I'm guessing you want to write "impl<'a> IntoIterator…
Post #AjuCtrlaeT1bitQvTs by [email protected]
0 likes, 0 repeats
@foone just call .iter() on the Vec: for command in commands.iter()
Post #AjuCtrrcI3qU1aFjsG by [email protected]
0 likes, 0 repeats
@tedmielczarek yeah that might be the way to go. it isn't as "elegant&…
Post #AjuCts3JaZCebrj56m by [email protected]
0 likes, 0 repeats
@foone (we can talk about the why if you want but I'm a little high and I t…
Post #AjuHkgD4kWVx2rjDai by [email protected]
0 likes, 0 repeats
I didn't figure that out. I instead just explicitly called iter() on the re…
Post #AjuI8aJMKe7RhW4A8e by [email protected]
0 likes, 0 repeats
now I'm trying to figure out the following:I have a vector of Commands (whi…
Post #AjuIGZhwSYu496NHg8 by [email protected]
0 likes, 0 repeats
which sounds like a match but I need to run a block of procedural code in respo…
Post #AjuIRknZZ4AxjFL4AS by [email protected]
0 likes, 0 repeats
so I need something like:for command in commands.iter(){ if type(command) == I…
Post #AjuIZFnIipFlt3muno by [email protected]
0 likes, 0 repeats
ahh there's a matches! macro
Post #AjuJMzarEJl67XgWZc by [email protected]
0 likes, 0 repeats
@foone um, are there hashmaps in rust? Or are those too immutable for that lan…
Post #AjuJMzgWtEIOP8L3Pk by [email protected]
0 likes, 0 repeats
@leean00 There are! I don't think they'd be useful here, as the orderin…
Post #AjuJguvoGzKlS9zCC0 by [email protected]
0 likes, 0 repeats
@Gaelan righto, if let is definitely cleaner for what I need. thanks!
Post #AjuKiXROgI3Z8F66zY by [email protected]
0 likes, 0 repeats
and if-let.I'm clone()ing everything these days. I'll make this more pe…
Post #AjuM7LWSELzZMSr95E by [email protected]
0 likes, 0 repeats
oh no, I'm borrowing a moved value! I'm not really sure what that means…
Post #AjuM7OCMHWhRf0Tdg0 by [email protected]
0 likes, 0 repeats
okay my code for the Include nonsense is actually working now.I have .clone() i…
Post #AjuOHxiPHkbGcOdXQe by [email protected]
0 likes, 1 repeats
@foone afaik the rust compiler optimizes out unnecessary clones so just run it …
Post #AjuOfq6hDxQ3yJNplQ by [email protected]
0 likes, 0 repeats
@foone Typically you'll build a new vec, rather than mutating the original
Post #AjuOfqCMsrxMFu2MbY by [email protected]
0 likes, 0 repeats
@StompyRobot right, that's what I did.
Post #AjuOpTFt2cUvzhH6TQ by [email protected]
0 likes, 0 repeats
@foone have you...have you built a sneeze-activated keyboard
Post #AjuOpTLYhX2EHHvdJY by [email protected]
0 likes, 0 repeats
@LionsPhil not yet. my allergies are complicated
Post #AjuPBhJ3TpodwZM5j6 by [email protected]
0 likes, 0 repeats
@technobaboo good to know! I don't know what clippy is but I can probably f…
Post #AjuPJVZQzuVBrWk0S8 by [email protected]
0 likes, 0 repeats
this code currently generates SVG files. I don't really want to look up how…
Post #AjuPxRE6ZGdVyNnvxg by [email protected]
0 likes, 1 repeats
@foone it's the rust linter, ties into rustfmt and all so you can specify e…
Post #AjuTZSmNXheXehevA0 by [email protected]
0 likes, 0 repeats
@technobaboo thanks!
Post #AjuVLQ6GuH6jCUOZ6W by [email protected]
0 likes, 0 repeats
I'm having to touch parsing code.it hurts but I'm managing
Post #AjuVTGo1LYsKgubMlk by [email protected]
0 likes, 0 repeats
I wonder if I can compile rust code for DOS
Post #AjuVZHSHqS7WRWImB6 by [email protected]
0 likes, 0 repeats
OH GOD NO NOT THE BRAZILIAN FLAGthe complexity of the Brazilian flag is half th…
Post #AjuWK45ZMIfib8z61o by [email protected]
0 likes, 0 repeats
@foone Zed has excellent builtin support; it’s what I’ve been using.
Post #AjuXiD0xvNWBBWuKrw by [email protected]
0 likes, 0 repeats
ok as I try to figure out how the parser works, I discover that I haven't p…
Post #AjuXs2D4x044ZSG6ng by [email protected]
0 likes, 0 repeats
so I'm going to have to somehow move the include handling into the parser, …
Post #AjuaHJeNRe3loDD5lY by [email protected]
0 likes, 0 repeats
anyway right now I'm trying to figure out parsing variable declarations. Th…
Post #AjuaOXrezksXv8s1fU by [email protected]
0 likes, 0 repeats
and I've got an enumeration that can be any of them but I'm not sure ho…
Post #AjubbtMKUPq0Iu8yTA by [email protected]
0 likes, 0 repeats
I solved it by writing wrapper functions that are basically identical. there is…
Post #AjufH9lgga9YvmNBB2 by [email protected]
0 likes, 0 repeats
handling errors and types are the two main complexities of rust that I've r…
Post #Ajuw1B4hl4AVZTEbJI by [email protected]
0 likes, 0 repeats
@DPA yeah. but this is also teaching me rust as a side-effect
Post #Ajuw21AW4hiN8YLyaW by [email protected]
0 likes, 0 repeats
I am making some kind of progress. I handled my Test file. variable references …
Post #AjuwCyenkkOEX6kFYu by [email protected]
0 likes, 0 repeats
because you're supposed to be able to use this syntax:$red=RGB(255,0,0)Rect…
Post #AjuwD1LPlHfGrqhJGC by [email protected]
0 likes, 0 repeats
this was working before, and I broke it. But I'm breaking it to be more gen…
Post #AjuwD27cs2EHHNFoPI by [email protected]
0 likes, 0 repeats
because the previous implementation was color-specific.But you should be able t…
Post #AjuwXbONRkDASXth20 by [email protected]
0 likes, 0 repeats
I've been yelling at rust for 10 hours today. I think that's enough for…
Post #AjuzpGzAM9NiFDDrwO by [email protected]
0 likes, 0 repeats
@foone Could be worse."On Error Resume Next" worse.🙃
Post #AjuzpH4q13v0WnsOmW by [email protected]
0 likes, 0 repeats
@retroswim I used to be a VB programmer! I know the pain!
Post #AjvD4wXdQvOOsM9DpQ by [email protected]
0 likes, 1 repeats
@foone I love how you've managed to compress the past 6 months of my life i…
Post #AjvJB7k5Ik9F4pIjzc by [email protected]
0 likes, 1 repeats
@foone seems like rust has been screaming back
Post #AjyKUrE76As94gCUQy by [email protected]
0 likes, 0 repeats
now I'm trying to figure out how to handle the type system for my language …
Post #AjyKrG73FlXid0Zxlg by [email protected]
0 likes, 0 repeats
since every command in VFL has specific types it takes for each argument. And r…
Post #AjyKyD0ZC7Rr1hrMzw by [email protected]
0 likes, 0 repeats
but right now I'm trying to add variables back into the language. and becau…
Post #AjyL4cqO3Bn2tO9rO4 by [email protected]
0 likes, 0 repeats
maybe I should learn how generics work?Then it could be ReferenceOrLiteral<S…
Post #AjyNmtAytAm8CC1boO by [email protected]
0 likes, 0 repeats
@foone not sure if this actually is helpful here, but maybe look at Cow<str&…
Post #AjyNmtH0Wlb0UsqQCm by [email protected]
0 likes, 0 repeats
@wez I don't think so. To be clear, these are references in VFL, the langua…
Post #Ak0hQKE0WnuxJ3sZpw by [email protected]
0 likes, 0 repeats
I skipped generics. now I'm just trying to write a generic resolve function…
Post #Ak0iVz9ns29NepAxCC by [email protected]
0 likes, 0 repeats
wasn't an issue! and now I have at least one command working with proper va…
Post #Ak0jaYMwzjrFyi4E9w by [email protected]
0 likes, 0 repeats
me: I don't need to support $foo=$bar syntax. You can only assign variables…
Post #Ak0kCJLpHQwKP8Xsv2 by [email protected]
0 likes, 0 repeats
okay that wasn't too hard to fix.
Post #Ak0lXDwOgqI7f1BfX6 by [email protected]
0 likes, 0 repeats
whoops I figured out how to implement fonts in my flag language
Post #Ak0ntsT2tSiLdAO7hw by [email protected]
0 likes, 0 repeats
@foone A flag language should be good for multithreaded programming because of …
Post #Ak0ntsZ4X3XDvrCw6K by [email protected]
0 likes, 0 repeats
@xorn hah!
Post #Ak0pH2Ybe8RhXPb7QG by [email protected]
0 likes, 0 repeats
my language should now be case insensitive.except for variables. right now thos…
Post #Ak0sbKEzuMM42Mn3YW by [email protected]
0 likes, 0 repeats
now I'm trying to figure out how to assign a fixed-length string, and faili…
Post #Ak0tJFdcNn0YVGFfTk by [email protected]
0 likes, 0 repeats
apparently the magic I need is .try_into()
Post #Ak0tSArZVNkiIg27VI by [email protected]
0 likes, 0 repeats
so now I gotta finish implementing a binary writer for the FLG bytecode, which …
Post #Ak0tSDXTYYSabDec64 by [email protected]
0 likes, 0 repeats
that's enough rust for one day
Post #Ak0voWAl9p7QfZn3Ym by [email protected]
0 likes, 0 repeats
@foone that will fail unless it's exactly 11 characters.
Post #Ak0voWGmnPwIyGbrxA by [email protected]
0 likes, 0 repeats
@dysfun that's fine, and in fact needed: I'm writing a binary file, so …
Post #Ak0voXL4owxwHrcoHQ by [email protected]
0 likes, 0 repeats
@foone if you want 'up to 11 characters', you want to `let mut x = [0; …
Post #Ak1u6wLsYYp0KFbkIa by [email protected]
0 likes, 1 repeats
@foone @RainofTerra Speaking of which, is there a browser plugin that will nuke…
Post #Ak6SBFDOXWGZ3phefw by [email protected]
0 likes, 0 repeats
now I gotta figure out how to do an enum that works like a C++ enum. like, I ne…
Post #Ak6ScCGLcmVVisw6ls by [email protected]
0 likes, 1 repeats
@foone I have no idea why Rust enums are not called unions, because that's …
Post #Ak6Sw2aPJLOhVHmUnw by [email protected]
0 likes, 0 repeats
this is easy, just stick =0, =1, =2 after the enum names, but the trick is gett…
Post #Ak6VfTjrPBqWefzsUy by [email protected]
0 likes, 0 repeats
@foone I enjoy your long discovery threads like this! Do you want Rust pointers…
Post #Ak6VfTpX46NowGePL6 by [email protected]
0 likes, 0 repeats
@str4d Sure.
Post #Ak6Vmxn64Q8Tt550xk by [email protected]
0 likes, 0 repeats
@kevin god damn, you're right. they're basically an enum+union combo, b…
Post #Ak6WjyxDOBLKa2xGEK by [email protected]
0 likes, 0 repeats
@foone which crate are you using?
Post #Ak6Wjz2t35scrdbn4S by [email protected]
0 likes, 0 repeats
@str4d BinWrite:https://docs.rs/binwrite/latest/binwrite/
Post #Ak6Wr3n7np7Nbsbtx2 by [email protected]
0 likes, 0 repeats
That's all fixed. just defined a preprocessor to turn the enum into an inte…
Post #Ak6Wr6RbwGgvq1ZGKm by [email protected]
0 likes, 0 repeats
One thing I'm not yet comfortable yet in rust is writing rust-style code. I…
Post #Ak6ZgwTgRI7vtUNr8q by [email protected]
0 likes, 0 repeats
this is supposed to be the rainbow flag. clearly something is /slightly/ wrong
Post #Ak6cc3Gq3WvZNNjeb2 by [email protected]
0 likes, 0 repeats
ahh!the way my rectangles work is backwards: I thought it was point-1, point-2,…
Post #Ak6ckU1KU6HMejV9X6 by [email protected]
0 likes, 1 repeats
BINGO
Post #Ak6di2bpWnCL14yR0K by [email protected]
0 likes, 0 repeats
okay so now I can do a full path from a VGA Flag Language (VFL) file, into the …
Post #Ak7EJxLx7Blu4KvSfg by [email protected]
0 likes, 0 repeats
@foone Can't really make sense of your writings on VFL, bytecode and so on,…
Post #Ak7EJxRcm6JCLvZzVo by [email protected]
0 likes, 0 repeats
@wasamasa not yet. There's a doc here with some info on how the language wo…
Post #Ak8L9rqzbHESxEXb84 by [email protected]
0 likes, 0 repeats
@foone BinWrite (or, certainly, its rewritten replacement BinRW, which I think …
Post #Ak8L9rxNDYKvH1Wh4i by [email protected]
0 likes, 0 repeats
@Jhynjhiruu BinWrite doesn't seem to, but I'll have to check out BinRW.…
You are viewing proxied material from pleroma.anduin.net. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.