pub struct DebugMarker {
pub session_id: String,
pub timestamp: u64,
pub description: Option<String>,
}Expand description
A debug marker that tracks metadata about inserted debug logs.
Format in code: /* ryo-debug:<session_id>:<timestamp>:<description> */
§Examples
use ryo_mutations::debugger::DebugMarker;
let marker = DebugMarker::new();
let comment = marker.to_comment();
assert!(comment.starts_with("/* ryo-debug:"));
// Parse back from comment
let parsed = DebugMarker::from_comment(&comment).unwrap();
assert_eq!(parsed.session_id, marker.session_id);Fields§
§session_id: StringUnique session identifier (groups related debug insertions).
timestamp: u64Unix timestamp when the marker was created.
description: Option<String>Optional description of what this debug log is for.
Implementations§
Source§impl DebugMarker
impl DebugMarker
Sourcepub fn with_session(session_id: impl Into<String>) -> Self
pub fn with_session(session_id: impl Into<String>) -> Self
Create a marker with a specific session ID.
Use this when adding multiple debug logs in the same session so they can be removed together.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Add a description to the marker.
Sourcepub fn to_comment(&self) -> String
pub fn to_comment(&self) -> String
Convert to a comment string for embedding in code.
Format: /* ryo-debug:<session_id>:<timestamp>:<description> */
Sourcepub fn to_marker_string(&self) -> String
pub fn to_marker_string(&self) -> String
Convert to a marker string (without comment delimiters).
Format: ryo-debug:<session_id>:<timestamp>:<description>
This is suitable for use as a string literal in code.
Sourcepub fn from_comment(s: &str) -> Option<Self>
pub fn from_comment(s: &str) -> Option<Self>
Parse a marker from a comment string or marker string.
Accepts both formats:
- Comment:
/* ryo-debug:session:ts:desc */ - String:
ryo-debug:session:ts:desc
Returns None if the string is not a valid ryo debug marker.
Sourcepub fn from_string_literal(s: &str) -> Option<Self>
pub fn from_string_literal(s: &str) -> Option<Self>
Parse a marker from a string literal (quoted string).
Accepts: "ryo-debug:session:ts:desc"
Sourcepub fn contains_marker(s: &str) -> bool
pub fn contains_marker(s: &str) -> bool
Check if a string contains a ryo debug marker.
Detects both comment format and string literal format.
Sourcepub fn extract_markers(s: &str) -> Vec<Self>
pub fn extract_markers(s: &str) -> Vec<Self>
Extract all markers from a string.
Trait Implementations§
Source§impl Clone for DebugMarker
impl Clone for DebugMarker
Source§fn clone(&self) -> DebugMarker
fn clone(&self) -> DebugMarker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DebugMarker
impl Debug for DebugMarker
Source§impl Default for DebugMarker
impl Default for DebugMarker
Source§impl<'de> Deserialize<'de> for DebugMarker
impl<'de> Deserialize<'de> for DebugMarker
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>,
Source§impl PartialEq for DebugMarker
impl PartialEq for DebugMarker
Source§fn eq(&self, other: &DebugMarker) -> bool
fn eq(&self, other: &DebugMarker) -> bool
self and other values to be equal, and is used by ==.