feat: rename Org::check to Org::validate

This commit is contained in:
PoiScript 2019-09-13 14:54:26 +08:00
parent 4d504ffe9b
commit f74feb82c9
3 changed files with 48 additions and 22 deletions

View file

@ -3,7 +3,7 @@ use indextree::NodeId;
use crate::elements::*;
use crate::Org;
/// Orgize Error
/// Orgize Validation Error
#[derive(Debug)]
pub enum OrgizeError {
/// Expect this node has children
@ -27,7 +27,8 @@ pub enum OrgizeError {
}
impl Org<'_> {
pub fn check(&self) -> Result<(), OrgizeError> {
/// Validate an `Org` struct.
pub fn validate(&self) -> Result<(), OrgizeError> {
for node_id in self.root.descendants(&self.arena) {
let node = &self.arena[node_id];
match node.get() {
@ -122,4 +123,10 @@ impl Org<'_> {
}
Ok(())
}
#[deprecated(since = "0.3.1", note = "rename to validate")]
/// Validate an `Org` struct.
pub fn check(&self) -> Result<(), OrgizeError> {
self.validate()
}
}