pub struct PointerRef<'db> {
pub relationship: Relationship,
pub part_of_speech: PartOfSpeech,
/* private fields */
}Expand description
Connects a Sense to words that relationship
A PointerRef has not been loaded from the database yet. You
can call read() to do that.
Fields§
§relationship: RelationshipThe relationship this pointer has
from the original word to to the sense
you can read with read()
part_of_speech: PartOfSpeechThe part of the speech that this new sense has.
Implementations§
Source§impl<'db> PointerRef<'db>
impl<'db> PointerRef<'db>
Sourcepub fn read(&self) -> Sense<'db>
pub fn read(&self) -> Sense<'db>
Read this pointer from the database files. This might lead to a Sense that you already have seen so be careful to not recurse indefinitely.
If you only use look at once relationship, then everything
should be ok
Examples found in repository?
More examples
examples/senses.rs (line 16)
11fn print_tree(indent : u32, ptr : &wordnet::PointerRef)
12{
13 if ptr.relationship != wordnet::Relationship::Hypernym
14 { return; }
15
16 let sense = ptr.read();
17 print_indent(indent);
18 println!(
19 " => {}",
20 sense.synonyms.iter().fold(
21 "".to_string(),
22 |acc,ref x|
23 {
24 let s = if acc.len()==0 { "" } else { ", " };
25 format!("{}{}{}", acc, s, x.word)
26 }
27 ),
28 );
29 for p in &sense.pointers
30 {
31 print_tree(indent+1, p);
32 }
33
34}Trait Implementations§
Auto Trait Implementations§
impl<'db> Freeze for PointerRef<'db>
impl<'db> RefUnwindSafe for PointerRef<'db>
impl<'db> Send for PointerRef<'db>
impl<'db> Sync for PointerRef<'db>
impl<'db> Unpin for PointerRef<'db>
impl<'db> UnsafeUnpin for PointerRef<'db>
impl<'db> UnwindSafe for PointerRef<'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more