Force the compiler and clippy to return a warning when a function isn't documented
This commit is contained in:
parent
8126a9ac2e
commit
5a6a70f1b7
@ -30,6 +30,7 @@ impl<'a> System<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// use thread_manager setter to send it system instance
|
||||
pub fn freeze(&'a mut self) {
|
||||
self.thread_manager.system.set(Option::Some(self));
|
||||
}
|
||||
|
14
src/main.rs
14
src/main.rs
@ -1,5 +1,16 @@
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![warn(clippy::missing_docs_in_private_items)]
|
||||
|
||||
//! Crate burritos ((BurritOS Using Rust Really Improves The Operating System)
|
||||
//!
|
||||
//! Burritos is an educational operating system written in Rust
|
||||
//! running on RISC-V emulator.
|
||||
|
||||
/// Contain hardware simulated part of the machine
|
||||
mod simulator;
|
||||
mod kernel;
|
||||
/// module containing useful tools which can be use in most part of the OS to ease the development of the OS
|
||||
pub mod utility;
|
||||
|
||||
use kernel::system::System;
|
||||
@ -7,5 +18,6 @@ use simulator::machine::Machine;
|
||||
|
||||
fn main() {
|
||||
let machine = Machine::init_machine();
|
||||
let _system = System::new(machine);
|
||||
let mut system = System::new(machine);
|
||||
system.freeze();
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
|
||||
/// Data structure and definition of a genericsingle-linked LIFO list.
|
||||
///
|
||||
/// This is a
|
||||
#[derive(PartialEq)]
|
||||
pub struct List<T: PartialEq> {
|
||||
head: Link<T>,
|
||||
}
|
||||
|
||||
|
||||
type Link<T> = Option<Box<Node<T>>>;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
@ -13,6 +17,8 @@ struct Node<T> {
|
||||
}
|
||||
|
||||
impl<T: PartialEq> List<T> {
|
||||
|
||||
/// Create an empty list
|
||||
pub fn new() -> Self {
|
||||
List { head: None }
|
||||
}
|
||||
@ -94,18 +100,26 @@ impl<T: PartialEq> List<T> {
|
||||
found
|
||||
}
|
||||
|
||||
/// Return true if the list is empty, false otherwise
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.head.is_none()
|
||||
}
|
||||
|
||||
/// Turn the list into an iterator for use in a for loop per example.
|
||||
///
|
||||
/// When you iter using into_iter, elements are remove from the list
|
||||
pub fn into_iter(self) -> IntoIter<T> {
|
||||
IntoIter(self)
|
||||
}
|
||||
|
||||
/// Turn the list into an iterator for use in a for loop
|
||||
///
|
||||
/// When you iter using this method, elements are dereferenced
|
||||
pub fn iter(&self) -> Iter<'_, T> {
|
||||
Iter { next: self.head.as_deref() }
|
||||
}
|
||||
|
||||
/// Same as iter but make the iterator mutable
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
|
||||
IterMut { next: self.head.as_deref_mut() }
|
||||
}
|
||||
@ -120,6 +134,7 @@ impl<T: PartialEq> Drop for List<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterator structure for use in a for loop, pop elements before returning it
|
||||
pub struct IntoIter<T: PartialEq>(List<T>);
|
||||
|
||||
impl<T: PartialEq> Iterator for IntoIter<T> {
|
||||
@ -130,6 +145,7 @@ impl<T: PartialEq> Iterator for IntoIter<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterator structure for use in a for loop, dereference before returning it
|
||||
pub struct Iter<'a, T> {
|
||||
next: Option<&'a Node<T>>,
|
||||
}
|
||||
@ -144,6 +160,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as Iter structure, returned item are mutable
|
||||
pub struct IterMut<'a, T> {
|
||||
next: Option<&'a mut Node<T>>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user