Fork channel

Create a new channel as a copy of main.

Rename channel

Rename main to:

Delete channel

Delete main? This cannot be undone.

lib.rs
use ropey::Rope;
use std::{fmt, fmt::Write};

#[derive(Clone, Debug, Default)]
pub struct RopeBuilderWrapper(ropey::RopeBuilder);

impl RopeBuilderWrapper {
	pub fn new() -> Self {
		Self(ropey::RopeBuilder::new())
	}

	pub fn append(&mut self, chunk: &str) {
		self.0.append(chunk);
	}

	pub fn finish(self) -> Rope {
		self.0.finish()
	}
}

impl Write for RopeBuilderWrapper {
	fn write_str(&mut self, s: &str) -> fmt::Result {
		self.append(s);
		Ok(())
	}
}

pub struct StringContainerA(pub Vec<String>);
pub struct StringContainerB(pub Vec<String>);

impl fmt::Display for StringContainerA {
	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
		let mut a = String::new();
		for b in &self.0 {
			a.push_str(&format!("{}", b))
		}
		write!(f, "{}", a)
	}
}

impl fmt::Display for StringContainerB {
	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
		let mut a = RopeBuilderWrapper::new();
		for b in &self.0 {
			write!(a, "{}", b)?
		}
		write!(f, "{}", a.finish())
	}
}