それよりは pub trait Lang { const MSG: &'static str; } pub struct Japanese; impl Lang for Japanese { const MSG: &'static str = "こんにちは"; } pub fn hello<L:Lang>() -> &'static str { L::MSG } みたいな設計にして使用側で切り替える方式の方が好き
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.