Add some doc

This commit is contained in:
Alexandre Bury 2015-05-22 16:57:29 -07:00
parent 602ec49332
commit 94e723d3f0
4 changed files with 9 additions and 1 deletions

View File

@ -22,6 +22,8 @@ fn main() {
thread::spawn(|| { generate_logs(tx); });
// And sets the view to read from the other end of the channel.
// (We use FullView to force fullscreen because
// we have no min_size for the BufferView).
siv.add_layer(FullView::new(BufferView::new(200, rx)));
siv.run();
@ -68,8 +70,8 @@ impl BufferView {
while let Ok(line) = self.rx.try_recv() {
i = (i+1) % self.buffer.len();
self.buffer[i] = line;
self.pos = i;
}
self.pos = i;
}
// Chain together the two parts of the buffer to appear as a circular one.

View File

@ -8,6 +8,7 @@ use std::path::Path;
use ncurses;
use toml;
/// Represents a colorpair from a Theme.
pub type ThemeColor = i16;
/// Application background, where no view is present.

View File

@ -1,7 +1,9 @@
/// Integer division that rounds up.
pub fn div_up_usize(p: usize, q: usize) -> usize {
div_up(p as u32, q as u32) as usize
}
/// Integer division that rounds up.
pub fn div_up(p: u32, q: u32) -> u32 {
if p % q == 0 { p/q }
else { 1 + p/q }

View File

@ -1,11 +1,14 @@
use view::{View,ViewWrapper,SizeRequest,DimensionRequest};
use vec::Vec2;
/// Simple wrapper view that asks for all the space it can get.
pub struct FullView<T: View> {
/// Wrapped view.
pub view: T,
}
impl <T: View> FullView<T> {
/// Wraps the given view into a new FullView.
pub fn new(view: T) -> Self {
FullView {
view: view,