#[cfg(not(feature = "foo"))] みたいな機能フラグの使い方をしだすととても辛くなるので止めておいた方が良いです
-
Show this thread
それよりは 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 } みたいな設計にして使用側で切り替える方式の方が好き
3:39 AM - 7 Mar 2020
0 replies
0 retweets
1 like
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.