#Anything I can improve, particularly naming, in this 67 line code?

23 messages · Page 1 of 1 (latest)

craggy hemlock
#

Thanks in advance.

green lotus
#

i would honestly just spell everything out

craggy hemlock
#

The use renaming and the naming of each Error variant is weird to me. IDK.

green lotus
#

except for the ip_addr and mac_addr

craggy hemlock
craggy hemlock
green lotus
craggy hemlock
#

Should I name my Error to ArpError or something? Then I'd have arp::ArpError but still.

green lotus
#

no

craggy hemlock
#

I see.

#

I'll be more clear with variable names so.

#

Thanks a lot.

green lotus
craggy hemlock
#

👍

sand pine
#

as far as the api design goes, the error type could use some work. it is lacking context, so when an user gets your IoError variant, it doesnt actually have useful information. it doesn't say what it was trying to do when the error happened, for example

craggy hemlock
#

Would NoChannel work?

sand pine
#

imagine if you wrote ```rust
#[derive(ThisError, Debug)]
pub enum Error {
#[error("lol fuck you")]
IoError(#[from] IoError),
}

craggy hemlock
#

I agree with you here, thought it was awkward too.

craggy hemlock
#

I might just make a ChannelError enum, then have an ArpError with a ChannelError variant holding the ChannelEnum

#

Because when I'm implementing an IpClient I'll have the same issue with channels.