pub struct GetLinksInputBuilder(/* private fields */);Expand description
A builder to streamline creating a GetLinksInput.
Example: Get links of any time from a given base address.
use hdk::prelude::*;
let my_base = ActionHash::from_raw_36(vec![0; 36]); // Some base address, this is a dummy address created for the example!
let links = get_links(LinkQuery::try_new(my_base, ..)?, GetStrategy::default())?;Example: Get links of a specific type from a given base address.
use hdk::prelude::*;
#[hdk_link_types]
pub enum LinkTypes {
Example,
}
let my_base = ActionHash::from_raw_36(vec![0; 36]); // Some base address, this is a dummy address created for the example!
let links = get_links(LinkQuery::try_new(my_base, LinkTypes::Example)?, GetStrategy::default())?;You can add additional filters using the functions defined on the builder. For example, to only fetch links that are available locally, without going to the network:
use hdk::prelude::*;
let my_base = ActionHash::from_raw_36(vec![0; 36]); // Some base address, this is a dummy address created for the example!
let links = get_links(LinkQuery::try_new(my_base, ..)?, GetStrategy::Local)?;Implementations§
Source§impl GetLinksInputBuilder
impl GetLinksInputBuilder
Sourcepub fn try_new(
base_address: impl Into<AnyLinkableHash>,
link_type: impl LinkTypeFilterExt,
) -> Result<Self, WasmError>
pub fn try_new( base_address: impl Into<AnyLinkableHash>, link_type: impl LinkTypeFilterExt, ) -> Result<Self, WasmError>
Create a new GetLinksInputBuilder from the required fields for a GetLinksInput.
Sourcepub fn get_options(self, get_strategy: GetStrategy) -> Self
pub fn get_options(self, get_strategy: GetStrategy) -> Self
Fetch links from network or local only.
Sourcepub fn tag_prefix(self, tag_prefix: LinkTag) -> Self
pub fn tag_prefix(self, tag_prefix: LinkTag) -> Self
Filter for links with the given tag prefix.
Filter for links created by this author.
Sourcepub fn build(self) -> GetLinksInput
pub fn build(self) -> GetLinksInput
Construct the result of the builder.
Trait Implementations§
Source§impl Clone for GetLinksInputBuilder
impl Clone for GetLinksInputBuilder
Source§fn clone(&self) -> GetLinksInputBuilder
fn clone(&self) -> GetLinksInputBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GetLinksInputBuilder
impl Debug for GetLinksInputBuilder
Source§impl PartialEq for GetLinksInputBuilder
impl PartialEq for GetLinksInputBuilder
impl StructuralPartialEq for GetLinksInputBuilder
Auto Trait Implementations§
impl Freeze for GetLinksInputBuilder
impl RefUnwindSafe for GetLinksInputBuilder
impl Send for GetLinksInputBuilder
impl Sync for GetLinksInputBuilder
impl Unpin for GetLinksInputBuilder
impl UnsafeUnpin for GetLinksInputBuilder
impl UnwindSafe for GetLinksInputBuilder
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