Expand description
String handling atoms.
This module contains two different atoms: The String
and the Literal
. The former is for simple, non-localized UTF-8 strings, like URIs or paths, and the later is either for localized text, e.g. descriptions in the user interface, or RDF literals.
Reading and writing these atoms is pretty simple: They don’t require a parameter and return a either a &str
or the literal info and a &str
. Writing is done with a writing handle which can append strings to the string/literal. When dropped, the handle will append the null character, you therefore don’t have to handle it on your own.
§Example
use lv2_core::prelude::*;
use lv2_atom::prelude::*;
use lv2_atom::string::StringWriter;
#[derive(PortCollection)]
struct MyPorts {
input: InputPort<AtomPort>,
output: OutputPort<AtomPort>,
}
fn run(ports: &mut MyPorts, urids: &AtomURIDCollection) {
let input: &str = ports.input.read(urids.string, ()).unwrap();
let mut writer: StringWriter = ports.output.init(urids.string, ()).unwrap();
writer.append(input).unwrap();
}
§Specifications
http://lv2plug.in/ns/ext/atom/atom.html#String http://lv2plug.in/ns/ext/atom/atom.html#Literal
Structs§
- Literal
- An atom containing either a localized string or an RDF literal.
- String
- An atom containing a UTF-8 encoded string.
- String
Writer - Handle to append strings to a string or literal.
Enums§
- Literal
Info - The type or language URID of a literal.