1
0
Fork 0
forked from wry/wry

config: add get_connector_by_name

This commit is contained in:
Julian Orth 2026-03-18 12:12:33 +01:00
parent 52b91654ca
commit cf36da4077
4 changed files with 31 additions and 0 deletions

View file

@ -454,6 +454,14 @@ pub fn get_connector(id: impl ToConnectorId) -> Connector {
get!(Connector(0)).get_connector(ty, idx)
}
/// Returns the connector with the given name.
///
/// Unlike [`get_connector`], this function can also be used for connectors whose names
/// don't follow the `<type>-<id>` pattern.
pub fn get_connector_by_name(name: &str) -> Connector {
get!(Connector(0)).get_connector_by_name(name)
}
/// A type that can be converted to a `(ConnectorType, idx)` tuple.
pub trait ToConnectorId {
fn to_connector_id(&self) -> Result<(ConnectorType, u32), String>;