Would the fields be "ordered" if they were from a struct as opposed to a hashmap?
struct Student {
number: usize,
...
marks: f32,
}
Also, guessing what kind of task you're up to, serde may be worth a look as an excellent library for serialisation to/from such a struct.
A quick search shows some others have gone down similar roads with serde, hashmaps and ordering: rust - How to sort HashMap keys when serializing with serde? - Stack Overflow