User avatar
Alice Averlong🏳️‍⚧️ @foone@digipres.club
1y
I'm writing rust without fully understanding the language. Pray for me.

Actually I guess that's true of most language I program in? Like, I'm sure there's some obscure python syntax or behavior I can't remember, despite calling myself a python programmer and having done it professionally for many years.

but my point was more that I barely know any rust. there's entire parts of syntax I don't understand yet. but I'm coding anyway!
1
0
2
0
User avatar
Alice Averlong🏳️‍⚧️ @foone@digipres.club
1y
I just had to look up why "str" didn't work (I mean "String", a different type entirely)
1
0
1
0
User avatar
Alice Averlong🏳️‍⚧️ @foone@digipres.club
1y
oh you have to define your return types. I didn't know that. I was returning the wrong ones and the compiler was mad
1
0
0
0
User avatar
Alice Averlong🏳️‍⚧️ @foone@digipres.club
1y
wait is this function returning the Result that Some of it is Ok?
1
0
0
0
User avatar
Alice Averlong🏳️‍⚧️ @foone@digipres.club
1y
I'm not entirely sure I am sober enough to understand how Results interact with Options<>

Result is an enum that's either Ok or Err, and Option is an enum that's either None or Some.

Is it that for Result, there's parameters with both Ok and Err, but with Option, there's no parameters with None?
And you just use them differently?
2
0
1
0
User avatar
pancakes nonbinary_cat @pancakes@meow.company
1y
@foone result is mainly for things that can fail while option is for stuff that could be null. none is a unit type while some, ok and err can contain any type
0
0
0
0