[−][src]Struct places::msg_types::BookmarkNode
A bookmark node.
We use a single message type for bookmarks. It covers insertion, deletion, and update, and represents all three bookmark types.
This simplifies the FFI by reducing the number of types that must go across it, and retuces boilderplate, but removes some static-ish guarantees we might have otherwise.
Note that these docs comments are internal, and don't necessarily impact the actual API we expose to Kotlin/Swift (this is particularly true around reads).
Fields
node_type: Option<i32>
The type of this bookmark, a BookmarkType
(from types.rs
).
This impacts which fields may be present.
It's illegal to attempt to change this when updating a bookmark.
Note: this probably should be an enum
, but prost seems to get upset
about it so we're just using int32 for now.
Note: this is node_type
and not type
because type
is reserved
in Rust.
- Always returned on reads.
- Required for inserts.
- Not provided for updates.
guid: Option<String>
The bookmarks guid.
- Always returned on reads.
- Not allowed for inserts.
- Required for updates (specifies which record is being changed)
date_added: Option<i64>
Creation time, in milliseconds since the unix epoch.
May not be a local timestamp, and may shift if new devices are able to provide an earlier (but still valid) timestamp.
- Always returned on reads.
- Ignored for insertion and update.
last_modified: Option<i64>
Last modification time, in milliseconds since the unix epoch.
- Always returned on reads.
- Ignored for insertion and update.
parent_guid: Option<String>
Guid of the parent record.
- Returned on reads, except for reads of the bookmark root.
- Required for insertion.
- On updates, if provided, we treat it as a move.
- Interacts with
position
, see its documentation below for details on how.
- Interacts with
position: Option<u32>
Zero based index within the parent.
-
Not provided on reads (for now).
-
Allowed for insertion.
- Leaving it out means 'end of folder'.
-
Allowed for updates.
-
If
parent_guid
is not provided andposition
is, we treat this a move within the same folder. -
If
parent_guid
andposition
are both provided, we treat this as a move to / within that folder, and we insert at the requested position. -
If
position
is not provided (andparent_guid
is) then it's treated as a move to the end of that folder.
-
title: Option<String>
Bookmark title. Not present for type = BookmarkType::Separator
.
- Returned on reads if it exists.
- Required when inserting folders.
url: Option<String>
Bookmark URL. Only allowed/present for type = BookmarkType::Bookmark
.
- Always returned on reads (for
BookmarkType::Bookmark
). - Required when inserting a new bookmark.
child_guids: Vec<String>
IDs of folder children, in order. Only present for type =
BookmarkType::Folder
.
- Returned on reads (for
BookmarkType::Folder
). - Forbidden for insertions and updates.
- Not provided if
child_nodes
is provided, to avoid sending more data over the FFI than necessary.
child_nodes: Vec<BookmarkNode>
Data about folder children, in order. Only present for type =
BookmarkType::Folder
.
For performance reasons, this only is provided if it's requested.
have_child_nodes: Option<bool>
Returned by reads, and used to distinguish between the cases of "empty child_nodes because the API doesn't return children" and "empty child_nodes because this folder has no children (but we'd populate them if it had them)".
Only required because you can't have optional repeated
.
Leaving this out is equivalent to false.
Implementations
impl BookmarkNode
[src]
pub(crate) fn get_node_type(&self) -> BookmarkType
[src]
Get the BookmarkType, panicking if it's invalid (because it really never should be unless we have a bug somewhere).
pub fn into_insertable(self) -> Result<InsertableItem>
[src]
Convert the protobuf bookmark into information for insertion.
impl BookmarkNode
[src]
pub fn node_type(&self) -> i32
[src]
Returns the value of node_type
, or the default value if node_type
is unset.
pub fn guid(&self) -> &str
[src]
Returns the value of guid
, or the default value if guid
is unset.
pub fn date_added(&self) -> i64
[src]
Returns the value of date_added
, or the default value if date_added
is unset.
pub fn last_modified(&self) -> i64
[src]
Returns the value of last_modified
, or the default value if last_modified
is unset.
pub fn parent_guid(&self) -> &str
[src]
Returns the value of parent_guid
, or the default value if parent_guid
is unset.
pub fn position(&self) -> u32
[src]
Returns the value of position
, or the default value if position
is unset.
pub fn title(&self) -> &str
[src]
Returns the value of title
, or the default value if title
is unset.
pub fn url(&self) -> &str
[src]
Returns the value of url
, or the default value if url
is unset.
pub fn have_child_nodes(&self) -> bool
[src]
Returns the value of have_child_nodes
, or the default value if have_child_nodes
is unset.
Trait Implementations
impl Clone for BookmarkNode
[src]
fn clone(&self) -> BookmarkNode
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for BookmarkNode
[src]
impl Default for BookmarkNode
[src]
fn default() -> BookmarkNode
[src]
impl From<BookmarkNode> for BookmarkUpdateInfo
[src]
fn from(n: BookmarkNode) -> Self
[src]
impl From<PublicNode> for BookmarkNode
[src]
fn from(n: PublicNode) -> Self
[src]
impl IntoFfi for BookmarkNode where
BookmarkNode: Message,
[src]
BookmarkNode: Message,
type Value = ByteBuffer
This type must be: Read more
fn ffi_default() -> Self::Value
[src]
fn into_ffi_value(self) -> Self::Value
[src]
impl Message for BookmarkNode
[src]
fn encode_raw<B>(&self, buf: &mut B) where
B: BufMut,
[src]
B: BufMut,
fn merge_field<B>(
&mut self,
tag: u32,
wire_type: WireType,
buf: &mut B,
ctx: DecodeContext
) -> Result<(), DecodeError> where
B: Buf,
[src]
&mut self,
tag: u32,
wire_type: WireType,
buf: &mut B,
ctx: DecodeContext
) -> Result<(), DecodeError> where
B: Buf,
fn encoded_len(&self) -> usize
[src]
fn clear(&mut self)
[src]
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
[src]
B: BufMut,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
[src]
B: BufMut,
fn decode<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
[src]
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
[src]
B: Buf,
Self: Default,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
[src]
B: Buf,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
[src]
B: Buf,
impl PartialEq<BookmarkNode> for BookmarkNode
[src]
fn eq(&self, other: &BookmarkNode) -> bool
[src]
fn ne(&self, other: &BookmarkNode) -> bool
[src]
impl StructuralPartialEq for BookmarkNode
[src]
Auto Trait Implementations
impl RefUnwindSafe for BookmarkNode
impl Send for BookmarkNode
impl Sync for BookmarkNode
impl Unpin for BookmarkNode
impl UnwindSafe for BookmarkNode
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> 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, 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>,