MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / from_str

Method from_str

atomic-semantic/src/entity.rs:58–73  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

56 type Err = ();
57
58 fn from_str(s: &str) -> Result<Self, Self::Err> {
59 match s {
60 "function" => Ok(EntityKind::Function),
61 "method" => Ok(EntityKind::Method),
62 "class" => Ok(EntityKind::Class),
63 "interface" => Ok(EntityKind::Interface),
64 "type_alias" => Ok(EntityKind::TypeAlias),
65 "const" => Ok(EntityKind::Const),
66 "variable" => Ok(EntityKind::Variable),
67 "enum" => Ok(EntityKind::Enum),
68 "module" => Ok(EntityKind::Module),
69 "import" => Ok(EntityKind::Import),
70 "export" => Ok(EntityKind::Export),
71 _ => Err(()),
72 }
73 }
74}
75
76impl std::fmt::Display for EntityKind {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected