pub struct Note {Show 13 fields
pub id: Uuid,
pub namespace: String,
pub kind: String,
pub status: String,
pub name: Option<String>,
pub content: String,
pub salience: Option<f64>,
pub decay_factor: Option<f64>,
pub expires_at: Option<i64>,
pub properties: Option<Value>,
pub created_at: i64,
pub updated_at: i64,
pub deleted_at: Option<i64>,
}Expand description
A storage-level note record. Flat, SQL-friendly representation.
Fields§
§id: Uuid§namespace: String§kind: String§status: String§name: Option<String>§content: String§salience: Option<f64>§decay_factor: Option<f64>§expires_at: Option<i64>§properties: Option<Value>§created_at: i64§updated_at: i64§deleted_at: Option<i64>Implementations§
Source§impl Note
impl Note
Sourcepub fn new(
namespace: impl Into<String>,
kind: impl Into<String>,
content: impl Into<String>,
) -> Self
pub fn new( namespace: impl Into<String>, kind: impl Into<String>, content: impl Into<String>, ) -> Self
Create a new note with a generated UUID and current timestamp.
Sourcepub fn with_salience(self, s: f64) -> Self
pub fn with_salience(self, s: f64) -> Self
Set salience (infallible). Rejects non-finite values by returning self
unchanged; clamps finite values to [0.0, 1.0]. Prefer
try_with_salience at public boundaries.
Sourcepub fn with_decay(self, d: f64) -> Self
pub fn with_decay(self, d: f64) -> Self
Set decay factor (infallible). Rejects non-finite values by returning
self unchanged; floors finite values at 0.0. Prefer
try_with_decay at public boundaries.
Sourcepub fn try_with_salience(self, s: f64) -> Result<Self, String>
pub fn try_with_salience(self, s: f64) -> Result<Self, String>
Set salience with validation. Returns an error for non-finite or
out-of-range [0.0, 1.0] values.
Sourcepub fn try_with_decay(self, d: f64) -> Result<Self, String>
pub fn try_with_decay(self, d: f64) -> Result<Self, String>
Set decay factor with validation. Returns an error for non-finite or negative values.
Sourcepub fn with_properties(self, p: Value) -> Self
pub fn with_properties(self, p: Value) -> Self
Set the note properties JSON blob.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Note
impl<'de> Deserialize<'de> for Note
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Note
impl RefUnwindSafe for Note
impl Send for Note
impl Sync for Note
impl Unpin for Note
impl UnsafeUnpin for Note
impl UnwindSafe for Note
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