gitui/asyncgit/src/lib.rs
Stephan Dilly 41a52cfc8c more clean solution that does not need git cli
* make test run in parallel again
* better test structure
2020-03-28 13:45:19 +01:00

50 lines
1 KiB
Rust

//! asyncgit
#![forbid(unsafe_code)]
#![forbid(missing_docs)]
#![deny(clippy::all)]
mod diff;
mod status;
pub mod sync;
pub use crate::{
diff::{AsyncDiff, DiffParams},
status::AsyncStatus,
sync::{
diff::{Diff, DiffLine, DiffLineType},
status::{StatusItem, StatusItemType},
},
};
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
time::{SystemTime, UNIX_EPOCH},
};
/// this type is used to communicate events back through the channel
#[derive(Copy, Clone, Debug)]
pub enum AsyncNotification {
///
Status,
///
Diff,
}
///
pub static CWD: &str = "./";
/// helper function to calculate the hash of an arbitrary type that implements the `Hash` trait
pub fn hash<T: Hash + ?Sized>(v: &T) -> u64 {
let mut hasher = DefaultHasher::new();
v.hash(&mut hasher);
hasher.finish()
}
/// helper function to return the current tick since unix epoch
pub fn current_tick() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_millis() as u64
}