Supreme God tier:
/dpt/ - Daily Programming Thread
What scripting language to use for my C program?
C
>he thinks java programmers are deterred by anime
first day here kiddo?
Typestate is great, but fuck me, trying to find syntax for it is hard.
lol
>can't answer with the usual oopsie plebbit response
>"lol" last thread
>"lol" this thread
You don't have very compelling reasons to make anyone believe you have anything intelligent to say
I'm trying to learn Rust by watching an IRC bot and when parsing incoming messages I had to write this gross line. Is there a better way to write this?
impl Message{
fn new(line: String) -> Message{
let mut parts = line.as_str()
.splitn(4," ")
.map(|x| x.to_string());
let (hostname,command,channel,message) = (parts.next().unwrap(),parts.next().unwrap(),parts.next().unwrap(),parts.next().unwrap());
Message{hostname:hostname,command:command,channel:channel,message:message[1..].to_string()}
}
}
What do you mean type state?