Download this file
| 1 | use std::io::Write; |
| 2 | use yrs::{Doc, Options}; |
| 3 | fn main() { |
| 4 | let doc = Doc::with_options(Options::with_guid_and_client_id( |
| 5 | "initial-wire".into(), |
| 6 | u32::MAX as u64, |
| 7 | )); |
| 8 | let mut input = Vec::new(); |
| 9 | for (level, text) in [(2u8, "Agenda 😀"), (0, "<script>& Café\n二")] { |
| 10 | input.push(level); |
| 11 | input.extend_from_slice(&(text.len() as u32).to_be_bytes()); |
| 12 | input.extend_from_slice(text.as_bytes()); |
| 13 | } |
| 14 | docs_core::initial::initialize(&doc, &input).unwrap(); |
| 15 | std::io::stdout() |
| 16 | .write_all(&docs_core::snapshot_bytes(&doc)) |
| 17 | .unwrap(); |
| 18 | } |
| 19 | |