commit
6a2dce2b0f
6 changed files with 18 additions and 21 deletions
|
@ -92,7 +92,7 @@ impl HabitTemplate for Entry {
|
||||||
.map_err(From::from)
|
.map_err(From::from)
|
||||||
.and_then(|mut entry| {
|
.and_then(|mut entry| {
|
||||||
{
|
{
|
||||||
let mut hdr = entry.get_header_mut();
|
let hdr = entry.get_header_mut();
|
||||||
hdr.insert("habit.instance.name", Value::String(name))?;
|
hdr.insert("habit.instance.name", Value::String(name))?;
|
||||||
hdr.insert("habit.instance.date", Value::String(date))?;
|
hdr.insert("habit.instance.date", Value::String(date))?;
|
||||||
hdr.insert("habit.instance.comment", Value::String(comment))?;
|
hdr.insert("habit.instance.comment", Value::String(comment))?;
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl GPSEntry for Entry {
|
||||||
"gps",
|
"gps",
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut hdr = self.get_header_mut();
|
let hdr = self.get_header_mut();
|
||||||
for pattern in patterns.iter() {
|
for pattern in patterns.iter() {
|
||||||
let _ = hdr.delete(pattern).chain_err(|| GPSEK::HeaderWriteError)?;
|
let _ = hdr.delete(pattern).chain_err(|| GPSEK::HeaderWriteError)?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -626,13 +626,13 @@ pub mod store_check {
|
||||||
incoming: Vec<StoreId>,
|
incoming: Vec<StoreId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to aggregate the Link network
|
// Helper function to aggregate the Link network
|
||||||
///
|
//
|
||||||
/// This function aggregates a HashMap which maps each StoreId object in the store onto
|
// This function aggregates a HashMap which maps each StoreId object in the store onto
|
||||||
/// a Linking object, which contains a list of StoreIds which this entry links to and a
|
// a Linking object, which contains a list of StoreIds which this entry links to and a
|
||||||
/// list of StoreIds which link to the current one.
|
// list of StoreIds which link to the current one.
|
||||||
///
|
//
|
||||||
/// The lambda returns an error if something fails
|
// The lambda returns an error if something fails
|
||||||
let aggregate_link_network = |store: &Store| -> Result<HashMap<StoreId, Linking>> {
|
let aggregate_link_network = |store: &Store| -> Result<HashMap<StoreId, Linking>> {
|
||||||
let iter = store
|
let iter = store
|
||||||
.entries()?
|
.entries()?
|
||||||
|
@ -669,9 +669,9 @@ pub mod store_check {
|
||||||
Ok(map)
|
Ok(map)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Helper to check whethre all StoreIds in the network actually exists
|
// Helper to check whethre all StoreIds in the network actually exists
|
||||||
///
|
//
|
||||||
/// Because why not?
|
// Because why not?
|
||||||
let all_collected_storeids_exist = |network: &HashMap<StoreId, Linking>| -> LResult<()> {
|
let all_collected_storeids_exist = |network: &HashMap<StoreId, Linking>| -> LResult<()> {
|
||||||
for (id, _) in network.iter() {
|
for (id, _) in network.iter() {
|
||||||
if is_match!(self.get(id.clone()), Ok(Some(_))) {
|
if is_match!(self.get(id.clone()), Ok(Some(_))) {
|
||||||
|
@ -690,14 +690,14 @@ pub mod store_check {
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Helper function to create a SLCECD::OneDirectionalLink error object
|
// Helper function to create a SLCECD::OneDirectionalLink error object
|
||||||
#[inline]
|
#[inline]
|
||||||
let mk_one_directional_link_err = |src: StoreId, target: StoreId| -> LE {
|
let mk_one_directional_link_err = |src: StoreId, target: StoreId| -> LE {
|
||||||
LE::from_kind(LEK::DeadLink(src, target))
|
LE::from_kind(LEK::DeadLink(src, target))
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Helper lambda to check whether the _incoming_ links of each entry actually also
|
// Helper lambda to check whether the _incoming_ links of each entry actually also
|
||||||
/// appear in the _outgoing_ list of the linked entry
|
// appear in the _outgoing_ list of the linked entry
|
||||||
let incoming_links_exists_as_outgoing_links =
|
let incoming_links_exists_as_outgoing_links =
|
||||||
|src: &StoreId, linking: &Linking, network: &HashMap<StoreId, Linking>| -> Result<()> {
|
|src: &StoreId, linking: &Linking, network: &HashMap<StoreId, Linking>| -> Result<()> {
|
||||||
for link in linking.incoming.iter() {
|
for link in linking.incoming.iter() {
|
||||||
|
@ -715,8 +715,8 @@ pub mod store_check {
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Helper lambda to check whether the _outgoing links of each entry actually also
|
// Helper lambda to check whether the _outgoing links of each entry actually also
|
||||||
/// appear in the _incoming_ list of the linked entry
|
// appear in the _incoming_ list of the linked entry
|
||||||
let outgoing_links_exist_as_incoming_links =
|
let outgoing_links_exist_as_incoming_links =
|
||||||
|src: &StoreId, linking: &Linking, network: &HashMap<StoreId, Linking>| -> Result<()> {
|
|src: &StoreId, linking: &Linking, network: &HashMap<StoreId, Linking>| -> Result<()> {
|
||||||
for link in linking.outgoing.iter() {
|
for link in linking.outgoing.iter() {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
extern crate notify_rust;
|
extern crate notify_rust;
|
||||||
#[macro_use] extern crate error_chain;
|
#[macro_use] extern crate error_chain;
|
||||||
|
|
||||||
#[macro_use] extern crate libimagerror;
|
extern crate libimagerror;
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod notificator;
|
pub mod notificator;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
use error::Result;
|
use error::Result;
|
||||||
use error::ResultExt;
|
|
||||||
|
|
||||||
/// A Notificator provides a function that can be called to notify about a certain object.
|
/// A Notificator provides a function that can be called to notify about a certain object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -105,9 +105,7 @@ pub mod ok {
|
||||||
|
|
||||||
use notificator::default::Notification;
|
use notificator::default::Notification;
|
||||||
use notificator::Notificator;
|
use notificator::Notificator;
|
||||||
use error::NotificationErrorKind as NEK;
|
|
||||||
use error::Result;
|
use error::Result;
|
||||||
use error::ResultExt;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct OkNotification(Notification);
|
pub struct OkNotification(Notification);
|
||||||
|
|
Loading…
Reference in a new issue