use orchid_api_derive::Coding; use orchid_api_traits::Request; use orchid_base::name::Sym; use orchid_extension::atom::{AtomMethod, Atomic, MethodSetBuilder, Supports}; use orchid_extension::atom_thin::{ThinAtom, ThinVariant}; use orchid_extension::context::i; use crate::std::protocol::types::{GetImplMethod, GetTagIdMethod}; #[derive(Coding, Clone, Debug)] pub struct AsStrTag; impl Atomic for AsStrTag { type Data = AsStrTag; type Variant = ThinVariant; fn reg_reqs() -> MethodSetBuilder { MethodSetBuilder::new().handle::().handle::() } } impl ThinAtom for AsStrTag {} impl Supports for AsStrTag { async fn handle(&self, _: GetTagIdMethod) -> ::Response { Sym::parse("std::string::to_string", &i()).await.unwrap().to_api() } } impl Supports for AsStrTag { async fn handle(&self, _: GetImplMethod) -> ::Response { None } } #[derive(Coding, Clone, Debug)] pub struct ToStringMethod; impl Request for ToStringMethod { type Response = String; } impl AtomMethod for ToStringMethod { const NAME: &str = "std::string::to_string"; }