[−][src]Struct gulkana::DataStructure
Struct usd to store data
Methods
impl<KeyType: Ord + Clone, ItemData: Clone> DataStructure<KeyType, ItemData>
[src]
pub fn insert(
&mut self,
key: &KeyType,
data: ItemData
) -> Result<(), DBOperationError>
[src]
&mut self,
key: &KeyType,
data: ItemData
) -> Result<(), DBOperationError>
Inserts data into datastructure
let mut ds = gulkana::new_datastructure::<u32,u32>(); ds.insert(&10,5);
pub fn insert_link(
&mut self,
key: &KeyType,
children: &Vec<KeyType>
) -> Result<(), DBOperationError>
[src]
&mut self,
key: &KeyType,
children: &Vec<KeyType>
) -> Result<(), DBOperationError>
Used to insert a link into a datastructure
let mut ds = gulkana::new_datastructure::<u32,u32>(); ds.insert(&10,5); ds.insert_link(&9,&vec![10]); let iter = ds.iter_links(&9).ok().unwrap(); for (i,j) in iter{ assert!(*j==5); }
pub fn overwrite_link(
&mut self,
key: &KeyType,
children: &Vec<KeyType>
) -> Result<(), DBOperationError>
[src]
&mut self,
key: &KeyType,
children: &Vec<KeyType>
) -> Result<(), DBOperationError>
Overwrites Links with vec shown
let mut ds = gulkana::new_datastructure::<u32,u32>(); ds.insert(&10,5); ds.insert(&11,6); ds.insert_link(&9,&vec![10]); ds.overwrite_link(&9,&vec![11]); let iter = ds.iter_links(&9).ok().unwrap(); for (_key,data) in iter{ assert!(*data==6); }
pub fn set_data(
&mut self,
key: &KeyType,
data: &ItemData
) -> Result<(), DBOperationError>
[src]
&mut self,
key: &KeyType,
data: &ItemData
) -> Result<(), DBOperationError>
sets data in database
let mut ds = gulkana::new_datastructure::<u32,u32>(); ds.insert(&10,3); ds.set_data(&10,&5); assert!(ds.get(&10).ok().unwrap()==&5);
ⓘImportant traits for DataNodeIter<'a, KeyType, DataType>pub fn iter_data(&self) -> DataNodeIter<KeyType, ItemData>
[src]
ⓘImportant traits for DataNodeIter<'a, KeyType, DataType>
Used to iterate through data
pub fn get(&self, key: &KeyType) -> Result<&ItemData, DBOperationError> where
KeyType: Ord,
[src]
KeyType: Ord,
gets key from database
let mut ds = gulkana::new_datastructure::<u32,u32>(); ds.insert(&10,5); let data = ds.get(&10); assert!(*data.ok().unwrap()==5);
pub fn get_links(
&self,
key: &KeyType
) -> Result<&Vec<KeyType>, DBOperationError>
[src]
&self,
key: &KeyType
) -> Result<&Vec<KeyType>, DBOperationError>
Gets linked nodes
let mut ds = gulkana::new_datastructure::<u32,u32>(); ds.insert(&10,5); ds.insert(&11,6); ds.insert_link(&9,&vec![10]); let v = ds.get_links(&9).ok().unwrap(); assert!(v[0]==10);
pub fn iter_links(
&self,
key: &KeyType
) -> Result<DataLinkIter<KeyType, ItemData>, DBOperationError>
[src]
&self,
key: &KeyType
) -> Result<DataLinkIter<KeyType, ItemData>, DBOperationError>
Iterates through nodes attached to link
pub fn contains(&self, key: &KeyType) -> bool
[src]
Checks if database contains a given key
let mut ds = gulkana::new_datastructure::<u32,u32>(); ds.insert(&10,5); assert!(ds.contains(&10)); assert!(!ds.contains(&20));
pub fn append_links(
&mut self,
key: &KeyType,
key_append: &KeyType
) -> Result<(), DBOperationError>
[src]
&mut self,
key: &KeyType,
key_append: &KeyType
) -> Result<(), DBOperationError>
pub fn right_join(
&self,
right: &DataStructure<KeyType, ItemData>
) -> Result<DataStructure<KeyType, ItemData>, DBOperationError>
[src]
&self,
right: &DataStructure<KeyType, ItemData>
) -> Result<DataStructure<KeyType, ItemData>, DBOperationError>
pub fn to_string(&self) -> Result<String, SerializeError> where
KeyType: Serialize,
ItemData: Serialize,
[src]
KeyType: Serialize,
ItemData: Serialize,
Trait Implementations
impl<KeyType: Clone + Ord, ItemData: Clone> Clone for DataStructure<KeyType, ItemData>
[src]
fn clone(&self) -> DataStructure<KeyType, ItemData>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'de, KeyType: Ord + Clone, ItemData: Clone> Deserialize<'de> for DataStructure<KeyType, ItemData> where
KeyType: Deserialize<'de>,
ItemData: Deserialize<'de>,
[src]
KeyType: Deserialize<'de>,
ItemData: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<K: Ord + Display + Clone + Serialize, I: Clone + Serialize> Display for DataStructure<K, I>
[src]
impl<KeyType: Eq + Ord + Clone, ItemData: Eq + Clone> Eq for DataStructure<KeyType, ItemData>
[src]
impl<KeyType: PartialEq + Ord + Clone, ItemData: PartialEq + Clone> PartialEq<DataStructure<KeyType, ItemData>> for DataStructure<KeyType, ItemData>
[src]
fn eq(&self, other: &DataStructure<KeyType, ItemData>) -> bool
[src]
fn ne(&self, other: &DataStructure<KeyType, ItemData>) -> bool
[src]
impl<KeyType: Ord + Clone, ItemData: Clone> Serialize for DataStructure<KeyType, ItemData> where
KeyType: Serialize,
ItemData: Serialize,
[src]
KeyType: Serialize,
ItemData: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<KeyType: Ord + Clone, ItemData: Clone> StructuralEq for DataStructure<KeyType, ItemData>
[src]
impl<KeyType: Ord + Clone, ItemData: Clone> StructuralPartialEq for DataStructure<KeyType, ItemData>
[src]
Auto Trait Implementations
impl<KeyType, ItemData> RefUnwindSafe for DataStructure<KeyType, ItemData> where
ItemData: RefUnwindSafe,
KeyType: RefUnwindSafe,
ItemData: RefUnwindSafe,
KeyType: RefUnwindSafe,
impl<KeyType, ItemData> Send for DataStructure<KeyType, ItemData> where
ItemData: Send,
KeyType: Send,
ItemData: Send,
KeyType: Send,
impl<KeyType, ItemData> Sync for DataStructure<KeyType, ItemData> where
ItemData: Sync,
KeyType: Sync,
ItemData: Sync,
KeyType: Sync,
impl<KeyType, ItemData> Unpin for DataStructure<KeyType, ItemData> where
ItemData: Unpin,
KeyType: Unpin,
ItemData: Unpin,
KeyType: Unpin,
impl<KeyType, ItemData> UnwindSafe for DataStructure<KeyType, ItemData> where
ItemData: RefUnwindSafe + UnwindSafe,
KeyType: RefUnwindSafe + UnwindSafe,
ItemData: RefUnwindSafe + UnwindSafe,
KeyType: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,