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: Relationship
The relationship this pointer has
from the original word to to the sense
you can read with read()
part_of_speech: PartOfSpeech
The 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)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
fn print_tree(indent : u32, ptr : &wordnet::PointerRef)
{
if ptr.relationship != wordnet::Relationship::Hypernym
{ return; }
let sense = ptr.read();
print_indent(indent);
println!(
" => {}",
sense.synonyms.iter().fold(
"".to_string(),
|acc,ref x|
{
let s = if acc.len()==0 { "" } else { ", " };
format!("{}{}{}", acc, s, x.word)
}
),
);
for p in &sense.pointers
{
print_tree(indent+1, p);
}
}
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> 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