Struct factorio_blueprint::BlueprintCodec [−][src]
pub struct BlueprintCodec;
Expand description
Utility class which knows how to convert JSON to and from Factorio’s blueprint string format.
Implementations
pub fn encode_writer<W, F>(writer: W, inner: F) -> Result<()> where
W: Write,
F: FnOnce(ZlibEncoder<&mut Base64Encoder<'_, VersionPrefixWriter<W>>>) -> Result<()>,
pub fn encode_writer<W, F>(writer: W, inner: F) -> Result<()> where
W: Write,
F: FnOnce(ZlibEncoder<&mut Base64Encoder<'_, VersionPrefixWriter<W>>>) -> Result<()>,
writer adaptor which encodes json data to blueprint string format
typically it is more useful to use encode
instead, but this method
provides some extra flexibility.
write the blueprint string to the given writer
produce a new owned string containing the blueprint string
pub fn decode_reader<R, F>(reader: R, inner: F) -> Result<()> where
R: Read,
F: FnOnce(ZlibDecoder<Base64Decoder<'_, VersionPrefixReader<WhitespaceRemover<R>>>>) -> Result<()>,
pub fn decode_reader<R, F>(reader: R, inner: F) -> Result<()> where
R: Read,
F: FnOnce(ZlibDecoder<Base64Decoder<'_, VersionPrefixReader<WhitespaceRemover<R>>>>) -> Result<()>,
reader adaptor which decodes a blueprint string to json
typically it is more useful to use decode
instead, but this method
gives flexibility in the event that it is required
read the blueprint string from the given reader
read the blueprint string from the given input