Implements fill_info

This commit is contained in:
Gregor Reitzenstein 2020-12-16 12:42:14 +01:00
parent 7bdbdac86b
commit cfa71f8be2

View File

@ -28,8 +28,32 @@ impl Machine {
// TODO set all the others // TODO set all the others
} }
pub fn fill_info(&self, builder: &mut m_info::Builder) { pub async fn fill_info(&self, builder: &mut m_info::Builder) {
unimplemented!() let guard = self.machine.lock().await;
builder.set_name(guard.desc.name.as_ref());
builder.set_description(guard.desc.description.as_ref());
match guard.state.read_only().lock_ref().status {
Status::Free => {
builder.set_state(State::Free);
}
Status::Disabled => {
builder.set_state(State::Disabled);
}
Status::Blocked(who, prio) => {
builder.set_state(State::Blocked);
}
Status::InUse(who, prio) => {
builder.set_state(State::InUse);
}
Status::ToCheck(who, prio) => {
builder.set_state(State::ToCheck);
}
Status::Reserved(who, prio) => {
builder.set_state(State::Reserved);
}
}
} }
} }