This makes the API significantly easier to use, especially since everything was just creating the same buffer anyways. If the user wants to use std::io::Write
, they can still do so, by using the lower-level Localize::message_for_locale
U2PHMYPDFQQYTPDVVJLWDJM5G45ILXLWDDDTZVV2NBOSCED323MQC
LU6IFZFGPIKF3CBWZWITWVBSCYWF7Q4UXJDXVRWZ4XV7PKE5RSTQC
BAH2JCJPTDXAE6XGSLIPBQZU4GQY65HI66Q4XTFNL65MV6VSNF2QC
JUV7C6ET4ZQJNLO7B4JB7XMLV2YUBZB4ARJHN4JEPHDGGBWGLEVAC
7M4UI3TWQIAA333GQ577HDWDWZPSZKWCYG556L6SBRLB6SZDQYPAC
HHJDRLLNN36UNIA7STAXEEVBCEMPJNB7SJQOS3TJLLYN4AEZ4MHQC
GJMBIJOE47X7DKZDHIY6VQ2ISC52XAVAV46L6PJQZTV7L7DDSWOAC
3NMKD6I57ONAGHEN4PZIAV2KPYESVR4JL3DTWSHXKCMVJBEQ4GIQC
.map(|item| {
let mut buffer = Vec::new();
item.localize(&mut buffer).map(|_| buffer)
})
.collect::<Result<Vec<Vec<u8>>, LocalizationError>>()?
.into_iter()
.map(|item| String::from_utf8(item).map_err(LocalizationError::InvalidOutput))
.map(Localize::localize)