Function linkspace::point::lk_linkpoint

source ·
pub fn lk_linkpoint(
    data: &[u8],
    domain: Domain,
    group: GroupID,
    spacename: &RootedSpace,
    links: &[Link],
    create_stamp: Option<Stamp>
) -> LkResult<NetPktBox>
Expand description

create a new linkpoint NetPktBox


let datap = lk_datapoint(b"this is a datapoint")?;
let space = rspace_buf(&[b"hello",b"world"]);
let links = [
    Link{tag: ab(b"a datapoint"),ptr:datap.hash()},
    Link{tag: ab(b"another tag"),ptr:PUBLIC}
];
let data = b"extra data for the linkpoint";
let create = Some(U64::new(0)); // None == Some(now()).
let linkpoint = lk_linkpoint(data,ab(b"mydomain"),PUBLIC,&space,&links,create)?;

assert_eq!(linkpoint.hash().to_string(),"IdnnQjgxJLGxLZGKdaXWVxc82-U8KyJoyKK3sKlD8Lc");
assert_eq!(linkpoint.data(), data);
assert_eq!(*linkpoint.get_group(), PUBLIC);