pub struct Plugin { /* private fields */ }Expand description
Can be used to instantiave LV2 plugins.
Implementations§
source§impl Plugin
impl Plugin
sourcepub fn verify(&self) -> bool
pub fn verify(&self) -> bool
Returns true if the plugin is valid. If the world was created with
World::load_all, then this is not necessary. Only valid plugins will
have been loaded.
sourcepub fn uri(&self) -> Node
pub fn uri(&self) -> Node
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
fn main() {
let world = World::new();
world.load_all();
let show_names = false;
let print = |plugin: Plugin| {
if show_names {
String::from(plugin.name().as_str().unwrap())
} else {
String::from(plugin.uri().as_uri().unwrap())
}
};
let plugins = world
.plugins()
.iter()
.filter(Plugin::verify)
.map(print)
.collect::<Vec<_>>();
debug_assert_eq!(world.plugins().count(), plugins.len());
for uri in plugins {
println!("{}", uri);
}
}More examples
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn bundle_uri(&self) -> Node
pub fn bundle_uri(&self) -> Node
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn data_uris(&self) -> Nodes
pub fn data_uris(&self) -> Nodes
The uri for the data.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn library_uri(&self) -> Option<Node>
pub fn library_uri(&self) -> Option<Node>
The uri for the library.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn name(&self) -> Node
pub fn name(&self) -> Node
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
fn main() {
let world = World::new();
world.load_all();
let show_names = false;
let print = |plugin: Plugin| {
if show_names {
String::from(plugin.name().as_str().unwrap())
} else {
String::from(plugin.uri().as_uri().unwrap())
}
};
let plugins = world
.plugins()
.iter()
.filter(Plugin::verify)
.map(print)
.collect::<Vec<_>>();
debug_assert_eq!(world.plugins().count(), plugins.len());
for uri in plugins {
println!("{}", uri);
}
}More examples
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn class(&self) -> Class
pub fn class(&self) -> Class
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn value(&self, predicate: &Node) -> Nodes
pub fn value(&self, predicate: &Node) -> Nodes
The value of the predicate. Nodes may be empty if the plugin does not
have one.
sourcepub fn has_feature(&self, feature_uri: &Node) -> bool
pub fn has_feature(&self, feature_uri: &Node) -> bool
true if the plugin supports the feature.
sourcepub fn supported_features(&self) -> Nodes
pub fn supported_features(&self) -> Nodes
The set of features that are supported.
sourcepub fn required_features(&self) -> Nodes
pub fn required_features(&self) -> Nodes
The set of features that are required to instantiate the plugin.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn optional_features(&self) -> Nodes
pub fn optional_features(&self) -> Nodes
The set of features that are optional to instantiate the plugin.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn has_extension_data(&self, uri: &Node) -> bool
pub fn has_extension_data(&self, uri: &Node) -> bool
Returns true if the plugin has extension data for uri.
sourcepub fn extension_data(&self) -> Option<Nodes>
pub fn extension_data(&self) -> Option<Nodes>
Get a sequence of all extension data provided by a plugin.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn ports_count(&self) -> usize
pub fn ports_count(&self) -> usize
Returns the number of ports for the plugin.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn port_ranges_float(&self) -> Vec<FloatRanges>
pub fn port_ranges_float(&self) -> Vec<FloatRanges>
Return the ranges for all ports.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn num_ports_of_class<I, N>(&self, classes: I) -> usizewhere
I: IntoIterator<Item = N>,
N: Borrow<Node>,
pub fn num_ports_of_class<I, N>(&self, classes: I) -> usizewhere I: IntoIterator<Item = N>, N: Borrow<Node>,
Returns the number of ports that match all the given classes.
sourcepub fn has_latency(&self) -> bool
pub fn has_latency(&self) -> bool
Returns wether or not the latency port can be found.
sourcepub fn latency_port_index(&self) -> Option<usize>
pub fn latency_port_index(&self) -> Option<usize>
Return the index of the plugin’s latency port or None if it does not exist.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn iter_ports(&self) -> impl Iterator<Item = Port>
pub fn iter_ports(&self) -> impl Iterator<Item = Port>
Returns an iterator over all the ports.
sourcepub fn port_by_index(&self, index: usize) -> Option<Port>
pub fn port_by_index(&self, index: usize) -> Option<Port>
Return the port by index or None if it does not exist.
Examples found in repository?
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
fn print_port(p: &Plugin, index: usize, port_ranges: &FloatRanges, nodes: &Nodes) {
let port = p.port_by_index(index);
println!("\n\tPort {}:", index);
if port.is_none() {
println!("\t\tERROR: Illegal/nonexistent port");
return;
}
let port = port.unwrap();
print!("\t\tType: ");
for (i, value) in port.classes().iter().enumerate() {
if i != 0 {
print!("\n\t\t ");
}
print!("{}", value.as_uri().unwrap());
}
if port.is_a(&nodes.event_class) {
let supported = port.value(&nodes.supports_event_pred);
if supported.count() > 0 {
println!("\n\t\tSupported events:\n");
for value in supported {
println!("\t\t\t{}", value.as_uri().unwrap());
}
}
}
let points = port.scale_points();
println!("\n\t\tScale Points:");
for point in points {
println!(
"\t\t\t{} = \"{}\"",
point.value().as_str().unwrap(),
point.label().as_str().unwrap(),
);
}
println!(
"\n\t\tSymbol: {}",
port.symbol().unwrap().as_str().unwrap(),
);
println!(
"\t\tName: {}",
port.name().unwrap().as_str().unwrap(),
);
let groups = port.value(&nodes.group_pred);
if let Some(group) = groups.iter().next() {
println!("\t\tGroup: {}", group.as_str().unwrap(),);
}
let designations = port.value(&nodes.designation_pred);
if let Some(designation) = designations.iter().next() {
println!("\t\tDesignation: {}", designation.as_str().unwrap(),);
}
if port.is_a(&nodes.control_class) {
let (min, max, def) = (port_ranges.min, port_ranges.max, port_ranges.default);
if !min.is_nan() {
println!("\t\tMinimum: {}", min);
}
if !max.is_nan() {
println!("\t\tMaximum: {}", max);
}
if !def.is_nan() {
println!("\t\tDefault: {}", def);
}
let properties = port.properties();
for (i, property) in properties.iter().enumerate() {
if i != 0 {
print!("\t\t ");
}
println!("{}", property.as_uri().unwrap());
}
println!();
}
}sourcepub fn port_by_symbol(&self, symbol: &Node) -> Option<Port>
pub fn port_by_symbol(&self, symbol: &Node) -> Option<Port>
Note: This function is slower than port_by_index, especially on
plugins with a very large number of ports.
sourcepub fn port_by_designation(
&self,
port_class: Option<&Node>,
designation: &Node
) -> Option<Port>
pub fn port_by_designation( &self, port_class: Option<&Node>, designation: &Node ) -> Option<Port>
Get a port on plugin by its lv2:designation.
The designation of a port describes the meaning, assignment, allocation
or role of the port, e.g. “left channel” or “gain”. If found, the port
with matching port_class and designation is be returned, otherwise
None is returned. The port_class can be used to distinguish the
input and output ports for a particular designation. If port_class is
None, any port with the given designation will be returned.
sourcepub fn project(&self) -> Option<Node>
pub fn project(&self) -> Option<Node>
Get the project the plugin is a part of.
More information about the project can be read with World::find_nodes.
Returns the author name if present.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}Returns the author email if present.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn is_replaced(&self) -> bool
pub fn is_replaced(&self) -> bool
true if the plugin has been replaced by another plugin.
The plugin will still be usable, but hosts should hide them from their user interfaces to prevent users fromusing deprecated plugins.
Get the resources related to plugin with lv2:appliesTo.
Some plugin-related resources are not linked directly to the plugin with rdfs:seeAlso and thus will not be automatically loaded along with the plugin data (usually for performance reasons). All such resources of the given type related to plugin can be accessed with this function.
If typ is None, all such resources will be returned, regardless of
type.
To actually load the data for each returned resource, use
World::load_resource().
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub fn uis(&self) -> Option<Uis>
pub fn uis(&self) -> Option<Uis>
Get all UIs for plugin.
Examples found in repository?
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
fn print_plugin(world: &World, p: &Plugin, nodes: &Nodes) {
println!("{}\n", p.uri().as_uri().unwrap());
println!("\tName: {}", p.name().as_str().unwrap());
println!(
"\tClass: {}",
p.class().label().as_str().unwrap()
);
if let Some(val) = p.author_name() {
println!("\tAuthor: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_email() {
println!("\tAuthor Email: {}", val.as_str().unwrap());
}
if let Some(val) = p.author_homepage() {
println!("\tAuthor Homepage: {}", val.as_uri().unwrap());
}
if let Some(latency_port) = p.latency_port_index() {
println!(
"\tHas latency: yes, reported by port {}",
latency_port
);
} else {
println!("\tHas latency: no");
}
println!("\tBundle: {}", p.bundle_uri().as_uri().unwrap());
println!(
"\tBinary: {}",
p.library_uri().map_or("<none>".to_string(), |node| node
.as_uri()
.unwrap()
.to_string())
);
if let Some(uis) = p.uis() {
println!("\tUIs:");
for ui in uis {
println!("\t\t{}", ui.uri().as_uri().unwrap());
for tyep in ui.classes() {
println!("\t\t\tClass: {}", tyep.as_uri().unwrap());
}
println!(
"\t\t\tBinary: {}",
ui.binary_uri().unwrap().as_uri().unwrap()
);
println!(
"\t\t\tBundle: {}",
ui.bundle_uri().unwrap().as_uri().unwrap()
);
}
}
print!("\tData URIs: ");
for (i, uri) in p.data_uris().iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", uri.as_uri().unwrap());
}
println!();
let features = p.required_features();
print!("\tRequired Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
let features = p.optional_features();
print!("\tOptional Features: ");
for (i, feature) in features.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", feature.as_uri().unwrap());
}
println!();
if let Some(data) = p.extension_data() {
print!("\tExtension Data: ");
for (i, d) in data.iter().enumerate() {
if i != 0 {
print!("\n\t ");
}
print!("{}", d.as_uri().unwrap());
}
println!();
}
if let Some(presets) = p.related(Some(&nodes.preset_class)) {
if presets.count() != 0 {
println!("\tPresets: ");
for preset in presets {
world.load_resource(&preset).unwrap();
let titles = world.find_nodes(Some(&preset), &nodes.label_pred, None);
if titles.count() > 0 {
if let Some(title) = titles.iter().next() {
println!("\t {}", title.as_str().unwrap());
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
} else {
println!("\t <{}>", preset.as_uri().unwrap());
}
}
}
}
let num_ports = p.ports_count();
let port_ranges = p.port_ranges_float();
assert_eq!(num_ports, port_ranges.len());
for (i, pr) in port_ranges.iter().enumerate() {
print_port(p, i, pr, nodes);
}
}sourcepub unsafe fn instantiate<'a, FS>(
&self,
sample_rate: f64,
features: FS
) -> Option<Instance>where
FS: IntoIterator<Item = &'a LV2Feature>,
pub unsafe fn instantiate<'a, FS>( &self, sample_rate: f64, features: FS ) -> Option<Instance>where FS: IntoIterator<Item = &'a LV2Feature>,
Instantiate a plugin.
Safety
Instantiating a plugin calls the plugin’s code which itself may be unsafe.