Skip to content

Commit 6e532c1

Browse files
committed
Filled in doc gaps for model.
1 parent d42f120 commit 6e532c1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

api/swimos_model/src/literal.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
use std::{borrow::Cow, fmt::Formatter};
1616

17+
/// Format a string as a Recon string literal, escaping it where necessary.
18+
///
19+
/// # Arguments
20+
/// * `literal` - The string to format as a literal.
21+
/// * `f` - The output formatter.
1722
pub fn write_string_literal(literal: &str, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
1823
if crate::identifier::is_identifier(literal) {
1924
f.write_str(literal)
@@ -24,6 +29,11 @@ pub fn write_string_literal(literal: &str, f: &mut Formatter<'_>) -> Result<(),
2429
}
2530
}
2631

32+
/// Escape a string so that it can be written as a Recon string literal. If the string does not
33+
/// require escapes a reference to the original string will be returned an no data will be copied.
34+
///
35+
/// # Arguments
36+
/// * `text` - The string to escape.
2737
pub fn escape_if_needed(text: &str) -> Cow<str> {
2838
if needs_escape(text) {
2939
Cow::Owned(escape_text(text))

api/swimos_model/src/value.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub enum Value {
9090
Data(Blob),
9191
}
9292

93+
/// The kinds of data that can be represented as a [`Value`].
9394
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
9495
pub enum ValueKind {
9596
Extant,

0 commit comments

Comments
 (0)