Files
VoelinClient/crates/voelin-ui/src/bind/convert/items.rs
T
faumarayandClaude Sonnet 5.5 ce7ec3afb7 Move the view models into voelin-ui-vm; the Slint models take plain rows
vm/{avatar,tree,servers,streams,home,chat,social,studio} and the UI
settings (settings.rs: keys, UiSettings, LastVoice, ClientPlaybackMap,
the audio form) move into voelin-ui-vm with their tests (102 there now;
the 86 view-model tests of voelin-ui all survive, the old list::sync test
became the list::diff tests). They produce the plain bridge structs, with
Rgb for colours and ImageRef for pictures:

- a file picture is ImageSource::File { path, stamp }: the engine writes
  a picture that arrives again into the same file, so the length and
  write time are part of the reference and a changed file redraws its
  row; size() reads the header once per stamp (no toolkit decoder);
- pictures held in memory (chat previews) are ImageSource::Memory;
- the line cache of the chat no longer keeps Slint models alive for
  pointer equality: plain lines compare by value, so an unchanged
  message makes the same line with or without the cache.

voelin-ui keeps every model as bind::rows::Rows<T>: the plain rows last
shown plus the VecModel, synced with list::diff, converting only the rows
that changed (bind/convert has the From impls). The controllers hand the
view-model rows to Rows::sync and convert forms at the bridge
(`.into()`); crate::vm is now `voelin_ui_vm as vm`, so paths stay.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 10:20:55 +03:00

2420 lines
53 KiB
Rust

//! The conversions of every bridge struct: plain to Slint for all of them,
//! Slint to plain for those without pictures (a picture cannot be turned back
//! into its source). Each struct lists all its fields, so a field added on one
//! side only does not compile.
use std::sync::Arc;
use slint::SharedString;
use voelin_ui_vm::bridge as vm;
use voelin_ui_vm::studio_bridge as studio;
use super::{color, image, images, ink, model, rows, strings, unink, unstrings};
use crate::app::*;
use crate::bind::rows::Row;
impl From<&vm::ServerItem> for ServerItem {
fn from(v: &vm::ServerItem) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
address: SharedString::from(&*v.address),
status: SharedString::from(&*v.status),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
icon: image(&v.icon),
unread: v.unread,
live: v.live,
detail: SharedString::from(&*v.detail),
product: SharedString::from(&*v.product),
gateway: v.gateway,
}
}
}
impl From<vm::ServerItem> for ServerItem {
fn from(v: vm::ServerItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::ServerItem {
type Shown = ServerItem;
fn show(&self) -> ServerItem {
ServerItem::from(self)
}
}
impl From<&vm::TreeItem> for TreeItem {
fn from(v: &vm::TreeItem) -> Self {
Self {
is_channel: v.is_channel,
spacer: v.spacer,
depth: v.depth,
id: v.id,
name: SharedString::from(&*v.name),
own: v.own,
talking: v.talking,
muted: v.muted,
sound_off: v.sound_off,
away: v.away,
streaming: v.streaming,
locked: v.locked,
collapsed: v.collapsed,
local_muted: v.local_muted,
local_volume: v.local_volume,
myself: v.myself,
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
members: v.members,
max_members: v.max_members,
icon: image(&v.icon),
icon_2: image(&v.icon_2),
icon_3: image(&v.icon_3),
badge: image(&v.badge),
badge_2: image(&v.badge_2),
badge_3: image(&v.badge_3),
banner: image(&v.banner),
banner_mode: v.banner_mode,
}
}
}
impl From<vm::TreeItem> for TreeItem {
fn from(v: vm::TreeItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::TreeItem {
type Shown = TreeItem;
fn show(&self) -> TreeItem {
TreeItem::from(self)
}
}
impl From<&vm::MemberItem> for MemberItem {
fn from(v: &vm::MemberItem) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
talking: v.talking,
muted: v.muted,
sound_off: v.sound_off,
away: v.away,
streaming: v.streaming,
myself: v.myself,
status: SharedString::from(&*v.status),
away_message: SharedString::from(&*v.away_message),
group: SharedString::from(&*v.group),
group_icon: image(&v.group_icon),
first_in_group: v.first_in_group,
group_count: v.group_count,
admin: v.admin,
role: SharedString::from(&*v.role),
priority: v.priority,
commander: v.commander,
recording: v.recording,
cannot_talk: v.cannot_talk,
badge: image(&v.badge),
badge_2: image(&v.badge_2),
badge_3: image(&v.badge_3),
}
}
}
impl From<vm::MemberItem> for MemberItem {
fn from(v: vm::MemberItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::MemberItem {
type Shown = MemberItem;
fn show(&self) -> MemberItem {
MemberItem::from(self)
}
}
impl From<&vm::BadgeItem> for BadgeItem {
fn from(v: &vm::BadgeItem) -> Self {
Self {
name: SharedString::from(&*v.name),
description: SharedString::from(&*v.description),
icon: image(&v.icon),
}
}
}
impl From<vm::BadgeItem> for BadgeItem {
fn from(v: vm::BadgeItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::BadgeItem {
type Shown = BadgeItem;
fn show(&self) -> BadgeItem {
BadgeItem::from(self)
}
}
impl From<&vm::MemberCard> for MemberCard {
fn from(v: &vm::MemberCard) -> Self {
Self {
open: v.open,
id: v.id,
name: SharedString::from(&*v.name),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
status: SharedString::from(&*v.status),
description: SharedString::from(&*v.description),
groups: strings(&v.groups),
badges: model(&v.badges),
country: SharedString::from(&*v.country),
talk_power: v.talk_power,
friend: v.friend,
blocked: v.blocked,
volume: v.volume,
muted: v.muted,
known: v.known,
streaming: v.streaming,
}
}
}
impl From<vm::MemberCard> for MemberCard {
fn from(v: vm::MemberCard) -> Self {
Self::from(&v)
}
}
impl Row for vm::MemberCard {
type Shown = MemberCard;
fn show(&self) -> MemberCard {
MemberCard::from(self)
}
}
impl From<&vm::ChatTab> for ChatTab {
fn from(v: &vm::ChatTab) -> Self {
Self {
title: SharedString::from(&*v.title),
name: SharedString::from(&*v.name),
kind: v.kind,
id: v.id,
unread: v.unread,
topic: SharedString::from(&*v.topic),
last: SharedString::from(&*v.last),
time: SharedString::from(&*v.time),
banner: image(&v.banner),
banner_mode: v.banner_mode,
}
}
}
impl From<vm::ChatTab> for ChatTab {
fn from(v: vm::ChatTab) -> Self {
Self::from(&v)
}
}
impl Row for vm::ChatTab {
type Shown = ChatTab;
fn show(&self) -> ChatTab {
ChatTab::from(self)
}
}
impl From<&vm::TextRun> for TextRun {
fn from(v: &vm::TextRun) -> Self {
Self {
text: SharedString::from(&*v.text),
emoji: SharedString::from(&*v.emoji),
bold: v.bold,
italic: v.italic,
underline: v.underline,
strike: v.strike,
code: v.code,
ink_dark: ink(v.ink_dark),
ink_light: ink(v.ink_light),
link: SharedString::from(&*v.link),
masked: v.masked,
}
}
}
impl From<vm::TextRun> for TextRun {
fn from(v: vm::TextRun) -> Self {
Self::from(&v)
}
}
impl Row for vm::TextRun {
type Shown = TextRun;
fn show(&self) -> TextRun {
TextRun::from(self)
}
}
impl From<TextRun> for vm::TextRun {
fn from(v: TextRun) -> Self {
Self {
text: Arc::from(v.text.as_str()),
emoji: Arc::from(v.emoji.as_str()),
bold: v.bold,
italic: v.italic,
underline: v.underline,
strike: v.strike,
code: v.code,
ink_dark: unink(v.ink_dark),
ink_light: unink(v.ink_light),
link: Arc::from(v.link.as_str()),
masked: v.masked,
}
}
}
impl From<&vm::TextBlock> for TextBlock {
fn from(v: &vm::TextBlock) -> Self {
Self { runs: model(&v.runs), kind: v.kind, caption: SharedString::from(&*v.caption) }
}
}
impl From<vm::TextBlock> for TextBlock {
fn from(v: vm::TextBlock) -> Self {
Self::from(&v)
}
}
impl Row for vm::TextBlock {
type Shown = TextBlock;
fn show(&self) -> TextBlock {
TextBlock::from(self)
}
}
impl From<TextBlock> for vm::TextBlock {
fn from(v: TextBlock) -> Self {
Self { runs: rows(&v.runs), kind: v.kind, caption: Arc::from(v.caption.as_str()) }
}
}
impl From<&vm::ReactionItem> for ReactionItem {
fn from(v: &vm::ReactionItem) -> Self {
Self {
key: SharedString::from(&*v.key),
text: SharedString::from(&*v.text),
count: v.count,
me: v.me,
}
}
}
impl From<vm::ReactionItem> for ReactionItem {
fn from(v: vm::ReactionItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::ReactionItem {
type Shown = ReactionItem;
fn show(&self) -> ReactionItem {
ReactionItem::from(self)
}
}
impl From<ReactionItem> for vm::ReactionItem {
fn from(v: ReactionItem) -> Self {
Self {
key: Arc::from(v.key.as_str()),
text: Arc::from(v.text.as_str()),
count: v.count,
me: v.me,
}
}
}
impl From<&vm::FileItem> for FileItem {
fn from(v: &vm::FileItem) -> Self {
Self {
name: SharedString::from(&*v.name),
detail: SharedString::from(&*v.detail),
index: v.index,
state: SharedString::from(&*v.state),
progress: v.progress,
picture: v.picture,
preview: image(&v.preview),
}
}
}
impl From<vm::FileItem> for FileItem {
fn from(v: vm::FileItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::FileItem {
type Shown = FileItem;
fn show(&self) -> FileItem {
FileItem::from(self)
}
}
impl From<&vm::ChatLine> for ChatLine {
fn from(v: &vm::ChatLine) -> Self {
Self {
key: v.key,
author: SharedString::from(&*v.author),
text: SharedString::from(&*v.text),
time: SharedString::from(&*v.time),
blocks: model(&v.blocks),
rich: v.rich,
jumbo: v.jumbo,
continued: v.continued,
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
blocked: v.blocked,
pinned: v.pinned,
reactions: model(&v.reactions),
files: model(&v.files),
remote: v.remote,
topic: SharedString::from(&*v.topic),
marked: v.marked,
link: SharedString::from(&*v.link),
unread_start: v.unread_start,
}
}
}
impl From<vm::ChatLine> for ChatLine {
fn from(v: vm::ChatLine) -> Self {
Self::from(&v)
}
}
impl Row for vm::ChatLine {
type Shown = ChatLine;
fn show(&self) -> ChatLine {
ChatLine::from(self)
}
}
impl From<&vm::PinItem> for PinItem {
fn from(v: &vm::PinItem) -> Self {
Self { line: (&v.line).into(), by: SharedString::from(&*v.by) }
}
}
impl From<vm::PinItem> for PinItem {
fn from(v: vm::PinItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::PinItem {
type Shown = PinItem;
fn show(&self) -> PinItem {
PinItem::from(self)
}
}
impl From<&vm::TopicItem> for TopicItem {
fn from(v: &vm::TopicItem) -> Self {
Self {
id: v.id,
title: SharedString::from(&*v.title),
creator: SharedString::from(&*v.creator),
detail: SharedString::from(&*v.detail),
activity: SharedString::from(&*v.activity),
recent: v.recent,
archived: v.archived,
}
}
}
impl From<vm::TopicItem> for TopicItem {
fn from(v: vm::TopicItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::TopicItem {
type Shown = TopicItem;
fn show(&self) -> TopicItem {
TopicItem::from(self)
}
}
impl From<TopicItem> for vm::TopicItem {
fn from(v: TopicItem) -> Self {
Self {
id: v.id,
title: Arc::from(v.title.as_str()),
creator: Arc::from(v.creator.as_str()),
detail: Arc::from(v.detail.as_str()),
activity: Arc::from(v.activity.as_str()),
recent: v.recent,
archived: v.archived,
}
}
}
impl From<&vm::BookmarkForm> for BookmarkForm {
fn from(v: &vm::BookmarkForm) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
address: SharedString::from(&*v.address),
nickname: SharedString::from(&*v.nickname),
server_password: SharedString::from(&*v.server_password),
connected: v.connected,
channel: SharedString::from(&*v.channel),
channel_password: SharedString::from(&*v.channel_password),
token: SharedString::from(&*v.token),
}
}
}
impl From<vm::BookmarkForm> for BookmarkForm {
fn from(v: vm::BookmarkForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::BookmarkForm {
type Shown = BookmarkForm;
fn show(&self) -> BookmarkForm {
BookmarkForm::from(self)
}
}
impl From<BookmarkForm> for vm::BookmarkForm {
fn from(v: BookmarkForm) -> Self {
Self {
id: v.id,
name: Arc::from(v.name.as_str()),
address: Arc::from(v.address.as_str()),
nickname: Arc::from(v.nickname.as_str()),
server_password: Arc::from(v.server_password.as_str()),
connected: v.connected,
channel: Arc::from(v.channel.as_str()),
channel_password: Arc::from(v.channel_password.as_str()),
token: Arc::from(v.token.as_str()),
}
}
}
impl From<&vm::StreamItem> for StreamItem {
fn from(v: &vm::StreamItem) -> Self {
Self {
id: SharedString::from(&*v.id),
name: SharedString::from(&*v.name),
streamer: SharedString::from(&*v.streamer),
channel: SharedString::from(&*v.channel),
streamer_id: v.streamer_id,
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
viewers: v.viewers,
audio: v.audio,
kind: SharedString::from(&*v.kind),
bitrate: SharedString::from(&*v.bitrate),
watching: v.watching,
own: v.own,
studio: v.studio,
}
}
}
impl From<vm::StreamItem> for StreamItem {
fn from(v: vm::StreamItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::StreamItem {
type Shown = StreamItem;
fn show(&self) -> StreamItem {
StreamItem::from(self)
}
}
impl From<&vm::ViewerItem> for ViewerItem {
fn from(v: &vm::ViewerItem) -> Self {
Self {
client: v.client,
name: SharedString::from(&*v.name),
state: SharedString::from(&*v.state),
message: SharedString::from(&*v.message),
avatar: image(&v.avatar),
}
}
}
impl From<vm::ViewerItem> for ViewerItem {
fn from(v: vm::ViewerItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::ViewerItem {
type Shown = ViewerItem;
fn show(&self) -> ViewerItem {
ViewerItem::from(self)
}
}
impl From<&vm::SourceItem> for SourceItem {
fn from(v: &vm::SourceItem) -> Self {
Self { name: SharedString::from(&*v.name), detail: SharedString::from(&*v.detail) }
}
}
impl From<vm::SourceItem> for SourceItem {
fn from(v: vm::SourceItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::SourceItem {
type Shown = SourceItem;
fn show(&self) -> SourceItem {
SourceItem::from(self)
}
}
impl From<SourceItem> for vm::SourceItem {
fn from(v: SourceItem) -> Self {
Self { name: Arc::from(v.name.as_str()), detail: Arc::from(v.detail.as_str()) }
}
}
impl From<&vm::ShareForm> for ShareForm {
fn from(v: &vm::ShareForm) -> Self {
Self {
source: v.source,
name: SharedString::from(&*v.name),
fps_index: v.fps_index,
fps: SharedString::from(&*v.fps),
bitrate_index: v.bitrate_index,
bitrate: SharedString::from(&*v.bitrate),
audio: v.audio,
auto_accept: v.auto_accept,
}
}
}
impl From<vm::ShareForm> for ShareForm {
fn from(v: vm::ShareForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::ShareForm {
type Shown = ShareForm;
fn show(&self) -> ShareForm {
ShareForm::from(self)
}
}
impl From<ShareForm> for vm::ShareForm {
fn from(v: ShareForm) -> Self {
Self {
source: v.source,
name: Arc::from(v.name.as_str()),
fps_index: v.fps_index,
fps: Arc::from(v.fps.as_str()),
bitrate_index: v.bitrate_index,
bitrate: Arc::from(v.bitrate.as_str()),
audio: v.audio,
auto_accept: v.auto_accept,
}
}
}
impl From<&vm::AudioForm> for AudioForm {
fn from(v: &vm::AudioForm) -> Self {
Self {
input_index: v.input_index,
output_index: v.output_index,
transmit: v.transmit,
vad_threshold: v.vad_threshold,
echo_cancellation: v.echo_cancellation,
noise_suppression: v.noise_suppression,
noise_level: v.noise_level,
auto_gain: v.auto_gain,
input_gain: v.input_gain,
output_volume: v.output_volume,
playback_buffer: v.playback_buffer,
}
}
}
impl From<vm::AudioForm> for AudioForm {
fn from(v: vm::AudioForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::AudioForm {
type Shown = AudioForm;
fn show(&self) -> AudioForm {
AudioForm::from(self)
}
}
impl From<AudioForm> for vm::AudioForm {
fn from(v: AudioForm) -> Self {
Self {
input_index: v.input_index,
output_index: v.output_index,
transmit: v.transmit,
vad_threshold: v.vad_threshold,
echo_cancellation: v.echo_cancellation,
noise_suppression: v.noise_suppression,
noise_level: v.noise_level,
auto_gain: v.auto_gain,
input_gain: v.input_gain,
output_volume: v.output_volume,
playback_buffer: v.playback_buffer,
}
}
}
impl From<&vm::ClientAudio> for ClientAudio {
fn from(v: &vm::ClientAudio) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
volume: v.volume,
muted: v.muted,
streaming: v.streaming,
}
}
}
impl From<vm::ClientAudio> for ClientAudio {
fn from(v: vm::ClientAudio) -> Self {
Self::from(&v)
}
}
impl Row for vm::ClientAudio {
type Shown = ClientAudio;
fn show(&self) -> ClientAudio {
ClientAudio::from(self)
}
}
impl From<ClientAudio> for vm::ClientAudio {
fn from(v: ClientAudio) -> Self {
Self {
id: v.id,
name: Arc::from(v.name.as_str()),
volume: v.volume,
muted: v.muted,
streaming: v.streaming,
}
}
}
impl From<&vm::AppearanceForm> for AppearanceForm {
fn from(v: &vm::AppearanceForm) -> Self {
Self {
theme: SharedString::from(&*v.theme),
font_scale: v.font_scale,
narrow_breakpoint: v.narrow_breakpoint,
image_cache_mb: v.image_cache_mb,
}
}
}
impl From<vm::AppearanceForm> for AppearanceForm {
fn from(v: vm::AppearanceForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::AppearanceForm {
type Shown = AppearanceForm;
fn show(&self) -> AppearanceForm {
AppearanceForm::from(self)
}
}
impl From<AppearanceForm> for vm::AppearanceForm {
fn from(v: AppearanceForm) -> Self {
Self {
theme: Arc::from(v.theme.as_str()),
font_scale: v.font_scale,
narrow_breakpoint: v.narrow_breakpoint,
image_cache_mb: v.image_cache_mb,
}
}
}
impl From<&vm::ContactItem> for ContactItem {
fn from(v: &vm::ContactItem) -> Self {
Self {
uid: SharedString::from(&*v.uid),
name: SharedString::from(&*v.name),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
relation: SharedString::from(&*v.relation),
online: v.online,
away: v.away,
streaming: v.streaming,
status: SharedString::from(&*v.status),
place: SharedString::from(&*v.place),
when: SharedString::from(&*v.when),
note: SharedString::from(&*v.note),
volume: v.volume,
muted: v.muted,
since: SharedString::from(&*v.since),
spots: strings(&v.spots),
reachable: v.reachable,
selected: v.selected,
}
}
}
impl From<vm::ContactItem> for ContactItem {
fn from(v: vm::ContactItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::ContactItem {
type Shown = ContactItem;
fn show(&self) -> ContactItem {
ContactItem::from(self)
}
}
impl From<&vm::LiveItem> for LiveItem {
fn from(v: &vm::LiveItem) -> Self {
Self {
session: v.session,
id: SharedString::from(&*v.id),
title: SharedString::from(&*v.title),
streamer: SharedString::from(&*v.streamer),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
server: SharedString::from(&*v.server),
channel: SharedString::from(&*v.channel),
viewers: v.viewers,
kind: SharedString::from(&*v.kind),
backdrop: color(v.backdrop),
watchable: v.watchable,
}
}
}
impl From<vm::LiveItem> for LiveItem {
fn from(v: vm::LiveItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::LiveItem {
type Shown = LiveItem;
fn show(&self) -> LiveItem {
LiveItem::from(self)
}
}
impl From<&vm::ConversationItem> for ConversationItem {
fn from(v: &vm::ConversationItem) -> Self {
Self {
key: v.key,
kind: v.kind,
title: SharedString::from(&*v.title),
server: SharedString::from(&*v.server),
preview: SharedString::from(&*v.preview),
time: SharedString::from(&*v.time),
ago: SharedString::from(&*v.ago),
unread: v.unread,
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
online: v.online,
selected: v.selected,
}
}
}
impl From<vm::ConversationItem> for ConversationItem {
fn from(v: vm::ConversationItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::ConversationItem {
type Shown = ConversationItem;
fn show(&self) -> ConversationItem {
ConversationItem::from(self)
}
}
impl From<&vm::NoticeItem> for NoticeItem {
fn from(v: &vm::NoticeItem) -> Self {
Self {
key: v.key,
kind: SharedString::from(&*v.kind),
title: SharedString::from(&*v.title),
body: SharedString::from(&*v.body),
time: SharedString::from(&*v.time),
unread: v.unread,
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
}
}
}
impl From<vm::NoticeItem> for NoticeItem {
fn from(v: vm::NoticeItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::NoticeItem {
type Shown = NoticeItem;
fn show(&self) -> NoticeItem {
NoticeItem::from(self)
}
}
impl From<&vm::SearchItem> for SearchItem {
fn from(v: &vm::SearchItem) -> Self {
Self {
kind: SharedString::from(&*v.kind),
title: SharedString::from(&*v.title),
subtitle: SharedString::from(&*v.subtitle),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
header: SharedString::from(&*v.header),
}
}
}
impl From<vm::SearchItem> for SearchItem {
fn from(v: vm::SearchItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::SearchItem {
type Shown = SearchItem;
fn show(&self) -> SearchItem {
SearchItem::from(self)
}
}
impl From<&vm::HappeningItem> for HappeningItem {
fn from(v: &vm::HappeningItem) -> Self {
Self {
kind: SharedString::from(&*v.kind),
title: SharedString::from(&*v.title),
subtitle: SharedString::from(&*v.subtitle),
when: SharedString::from(&*v.when),
session: v.session,
id: v.id,
live: v.live,
}
}
}
impl From<vm::HappeningItem> for HappeningItem {
fn from(v: vm::HappeningItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::HappeningItem {
type Shown = HappeningItem;
fn show(&self) -> HappeningItem {
HappeningItem::from(self)
}
}
impl From<HappeningItem> for vm::HappeningItem {
fn from(v: HappeningItem) -> Self {
Self {
kind: Arc::from(v.kind.as_str()),
title: Arc::from(v.title.as_str()),
subtitle: Arc::from(v.subtitle.as_str()),
when: Arc::from(v.when.as_str()),
session: v.session,
id: v.id,
live: v.live,
}
}
}
impl From<&vm::ResumeItem> for ResumeItem {
fn from(v: &vm::ResumeItem) -> Self {
Self {
shown: v.shown,
server_id: v.server_id,
server: SharedString::from(&*v.server),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
icon: image(&v.icon),
channel: SharedString::from(&*v.channel),
open: v.open,
connecting: v.connecting,
}
}
}
impl From<vm::ResumeItem> for ResumeItem {
fn from(v: vm::ResumeItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::ResumeItem {
type Shown = ResumeItem;
fn show(&self) -> ResumeItem {
ResumeItem::from(self)
}
}
impl From<&vm::EventItem> for EventItem {
fn from(v: &vm::EventItem) -> Self {
Self {
id: v.id,
title: SharedString::from(&*v.title),
description: SharedString::from(&*v.description),
weekday: SharedString::from(&*v.weekday),
day: SharedString::from(&*v.day),
month: SharedString::from(&*v.month),
when: SharedString::from(&*v.when),
place: SharedString::from(&*v.place),
stream: SharedString::from(&*v.stream),
live: v.live,
going: v.going,
maybe: v.maybe,
not_going: v.not_going,
rsvp: SharedString::from(&*v.rsvp),
creator: SharedString::from(&*v.creator),
editable: v.editable,
soon: SharedString::from(&*v.soon),
attendees: strings(&v.attendees),
expanded: v.expanded,
}
}
}
impl From<vm::EventItem> for EventItem {
fn from(v: vm::EventItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::EventItem {
type Shown = EventItem;
fn show(&self) -> EventItem {
EventItem::from(self)
}
}
impl From<EventItem> for vm::EventItem {
fn from(v: EventItem) -> Self {
Self {
id: v.id,
title: Arc::from(v.title.as_str()),
description: Arc::from(v.description.as_str()),
weekday: Arc::from(v.weekday.as_str()),
day: Arc::from(v.day.as_str()),
month: Arc::from(v.month.as_str()),
when: Arc::from(v.when.as_str()),
place: Arc::from(v.place.as_str()),
stream: Arc::from(v.stream.as_str()),
live: v.live,
going: v.going,
maybe: v.maybe,
not_going: v.not_going,
rsvp: Arc::from(v.rsvp.as_str()),
creator: Arc::from(v.creator.as_str()),
editable: v.editable,
soon: Arc::from(v.soon.as_str()),
attendees: unstrings(&v.attendees),
expanded: v.expanded,
}
}
}
impl From<&vm::EventForm> for EventForm {
fn from(v: &vm::EventForm) -> Self {
Self {
id: v.id,
title: SharedString::from(&*v.title),
description: SharedString::from(&*v.description),
start: SharedString::from(&*v.start),
end: SharedString::from(&*v.end),
channel: v.channel,
stream: v.stream,
stream_title: SharedString::from(&*v.stream_title),
game: SharedString::from(&*v.game),
}
}
}
impl From<vm::EventForm> for EventForm {
fn from(v: vm::EventForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::EventForm {
type Shown = EventForm;
fn show(&self) -> EventForm {
EventForm::from(self)
}
}
impl From<EventForm> for vm::EventForm {
fn from(v: EventForm) -> Self {
Self {
id: v.id,
title: Arc::from(v.title.as_str()),
description: Arc::from(v.description.as_str()),
start: Arc::from(v.start.as_str()),
end: Arc::from(v.end.as_str()),
channel: v.channel,
stream: v.stream,
stream_title: Arc::from(v.stream_title.as_str()),
game: Arc::from(v.game.as_str()),
}
}
}
impl From<&vm::OfflineForm> for OfflineForm {
fn from(v: &vm::OfflineForm) -> Self {
Self {
uid: SharedString::from(&*v.uid),
to: SharedString::from(&*v.to),
subject: SharedString::from(&*v.subject),
text: SharedString::from(&*v.text),
}
}
}
impl From<vm::OfflineForm> for OfflineForm {
fn from(v: vm::OfflineForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::OfflineForm {
type Shown = OfflineForm;
fn show(&self) -> OfflineForm {
OfflineForm::from(self)
}
}
impl From<OfflineForm> for vm::OfflineForm {
fn from(v: OfflineForm) -> Self {
Self {
uid: Arc::from(v.uid.as_str()),
to: Arc::from(v.to.as_str()),
subject: Arc::from(v.subject.as_str()),
text: Arc::from(v.text.as_str()),
}
}
}
impl From<&vm::DmPeer> for DmPeer {
fn from(v: &vm::DmPeer) -> Self {
Self {
open: v.open,
uid: SharedString::from(&*v.uid),
name: SharedString::from(&*v.name),
initials: SharedString::from(&*v.initials),
tint: color(v.tint),
avatar: image(&v.avatar),
online: v.online,
status: SharedString::from(&*v.status),
description: SharedString::from(&*v.description),
groups: strings(&v.groups),
note: SharedString::from(&*v.note),
since: SharedString::from(&*v.since),
servers: strings(&v.servers),
media: images(&v.media),
media_more: v.media_more,
files: model(&v.files),
friend: v.friend,
blocked: v.blocked,
volume: v.volume,
muted: v.muted,
can_send: v.can_send,
notice: SharedString::from(&*v.notice),
offline: v.offline,
can_connect: v.can_connect,
stored: v.stored,
mail: v.mail,
mail_subject: SharedString::from(&*v.mail_subject),
mail_text: SharedString::from(&*v.mail_text),
mail_time: SharedString::from(&*v.mail_time),
}
}
}
impl From<vm::DmPeer> for DmPeer {
fn from(v: vm::DmPeer) -> Self {
Self::from(&v)
}
}
impl Row for vm::DmPeer {
type Shown = DmPeer;
fn show(&self) -> DmPeer {
DmPeer::from(self)
}
}
impl From<&vm::IdentityItem> for IdentityItem {
fn from(v: &vm::IdentityItem) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
uid: SharedString::from(&*v.uid),
uid6: SharedString::from(&*v.uid6),
level: v.level,
default: v.default,
origin: SharedString::from(&*v.origin),
improving: v.improving,
reached: v.reached,
used_by: SharedString::from(&*v.used_by),
}
}
}
impl From<vm::IdentityItem> for IdentityItem {
fn from(v: vm::IdentityItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::IdentityItem {
type Shown = IdentityItem;
fn show(&self) -> IdentityItem {
IdentityItem::from(self)
}
}
impl From<IdentityItem> for vm::IdentityItem {
fn from(v: IdentityItem) -> Self {
Self {
id: v.id,
name: Arc::from(v.name.as_str()),
uid: Arc::from(v.uid.as_str()),
uid6: Arc::from(v.uid6.as_str()),
level: v.level,
default: v.default,
origin: Arc::from(v.origin.as_str()),
improving: v.improving,
reached: v.reached,
used_by: Arc::from(v.used_by.as_str()),
}
}
}
impl From<&vm::FoundIdentity> for FoundIdentity {
fn from(v: &vm::FoundIdentity) -> Self {
Self {
name: SharedString::from(&*v.name),
uid: SharedString::from(&*v.uid),
level: v.level,
source: SharedString::from(&*v.source),
known: v.known,
picked: v.picked,
}
}
}
impl From<vm::FoundIdentity> for FoundIdentity {
fn from(v: vm::FoundIdentity) -> Self {
Self::from(&v)
}
}
impl Row for vm::FoundIdentity {
type Shown = FoundIdentity;
fn show(&self) -> FoundIdentity {
FoundIdentity::from(self)
}
}
impl From<FoundIdentity> for vm::FoundIdentity {
fn from(v: FoundIdentity) -> Self {
Self {
name: Arc::from(v.name.as_str()),
uid: Arc::from(v.uid.as_str()),
level: v.level,
source: Arc::from(v.source.as_str()),
known: v.known,
picked: v.picked,
}
}
}
impl From<&vm::BookmarkIdentity> for BookmarkIdentity {
fn from(v: &vm::BookmarkIdentity) -> Self {
Self { id: v.id, name: SharedString::from(&*v.name), identity: v.identity }
}
}
impl From<vm::BookmarkIdentity> for BookmarkIdentity {
fn from(v: vm::BookmarkIdentity) -> Self {
Self::from(&v)
}
}
impl Row for vm::BookmarkIdentity {
type Shown = BookmarkIdentity;
fn show(&self) -> BookmarkIdentity {
BookmarkIdentity::from(self)
}
}
impl From<BookmarkIdentity> for vm::BookmarkIdentity {
fn from(v: BookmarkIdentity) -> Self {
Self { id: v.id, name: Arc::from(v.name.as_str()), identity: v.identity }
}
}
impl From<&vm::VideoForm> for VideoForm {
fn from(v: &vm::VideoForm) -> Self {
Self {
camera: v.camera,
background: v.background,
resolution: SharedString::from(&*v.resolution),
fps: SharedString::from(&*v.fps),
codec: v.codec,
hardware: v.hardware,
mirror: v.mirror,
permissions: v.permissions,
quality: v.quality,
bitrate: v.bitrate,
preview: v.preview,
}
}
}
impl From<vm::VideoForm> for VideoForm {
fn from(v: vm::VideoForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::VideoForm {
type Shown = VideoForm;
fn show(&self) -> VideoForm {
VideoForm::from(self)
}
}
impl From<VideoForm> for vm::VideoForm {
fn from(v: VideoForm) -> Self {
Self {
camera: v.camera,
background: v.background,
resolution: Arc::from(v.resolution.as_str()),
fps: Arc::from(v.fps.as_str()),
codec: v.codec,
hardware: v.hardware,
mirror: v.mirror,
permissions: v.permissions,
quality: v.quality,
bitrate: v.bitrate,
preview: v.preview,
}
}
}
impl From<&vm::LayerItem> for LayerItem {
fn from(v: &vm::LayerItem) -> Self {
Self {
size: SharedString::from(&*v.size),
fps: SharedString::from(&*v.fps),
bitrate: SharedString::from(&*v.bitrate),
min_bitrate: SharedString::from(&*v.min_bitrate),
max_bitrate: SharedString::from(&*v.max_bitrate),
}
}
}
impl From<vm::LayerItem> for LayerItem {
fn from(v: vm::LayerItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::LayerItem {
type Shown = LayerItem;
fn show(&self) -> LayerItem {
LayerItem::from(self)
}
}
impl From<LayerItem> for vm::LayerItem {
fn from(v: LayerItem) -> Self {
Self {
size: Arc::from(v.size.as_str()),
fps: Arc::from(v.fps.as_str()),
bitrate: Arc::from(v.bitrate.as_str()),
min_bitrate: Arc::from(v.min_bitrate.as_str()),
max_bitrate: Arc::from(v.max_bitrate.as_str()),
}
}
}
impl From<&vm::AudioSourceItem> for AudioSourceItem {
fn from(v: &vm::AudioSourceItem) -> Self {
Self {
kind: SharedString::from(&*v.kind),
name: SharedString::from(&*v.name),
detail: SharedString::from(&*v.detail),
gain: v.gain,
muted: v.muted,
}
}
}
impl From<vm::AudioSourceItem> for AudioSourceItem {
fn from(v: vm::AudioSourceItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::AudioSourceItem {
type Shown = AudioSourceItem;
fn show(&self) -> AudioSourceItem {
AudioSourceItem::from(self)
}
}
impl From<AudioSourceItem> for vm::AudioSourceItem {
fn from(v: AudioSourceItem) -> Self {
Self {
kind: Arc::from(v.kind.as_str()),
name: Arc::from(v.name.as_str()),
detail: Arc::from(v.detail.as_str()),
gain: v.gain,
muted: v.muted,
}
}
}
impl From<&vm::StreamingForm> for StreamingForm {
fn from(v: &vm::StreamingForm) -> Self {
Self {
fps: SharedString::from(&*v.fps),
bitrate: SharedString::from(&*v.bitrate),
codec: v.codec,
capture: v.capture,
replay_seconds: SharedString::from(&*v.replay_seconds),
replay_memory: SharedString::from(&*v.replay_memory),
recording_dir: SharedString::from(&*v.recording_dir),
}
}
}
impl From<vm::StreamingForm> for StreamingForm {
fn from(v: vm::StreamingForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::StreamingForm {
type Shown = StreamingForm;
fn show(&self) -> StreamingForm {
StreamingForm::from(self)
}
}
impl From<StreamingForm> for vm::StreamingForm {
fn from(v: StreamingForm) -> Self {
Self {
fps: Arc::from(v.fps.as_str()),
bitrate: Arc::from(v.bitrate.as_str()),
codec: v.codec,
capture: v.capture,
replay_seconds: Arc::from(v.replay_seconds.as_str()),
replay_memory: Arc::from(v.replay_memory.as_str()),
recording_dir: Arc::from(v.recording_dir.as_str()),
}
}
}
impl From<&vm::NotifyForm> for NotifyForm {
fn from(v: &vm::NotifyForm) -> Self {
Self {
mentions: v.mentions,
pokes: v.pokes,
messages: v.messages,
events: v.events,
friends: v.friends,
}
}
}
impl From<vm::NotifyForm> for NotifyForm {
fn from(v: vm::NotifyForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::NotifyForm {
type Shown = NotifyForm;
fn show(&self) -> NotifyForm {
NotifyForm::from(self)
}
}
impl From<NotifyForm> for vm::NotifyForm {
fn from(v: NotifyForm) -> Self {
Self {
mentions: v.mentions,
pokes: v.pokes,
messages: v.messages,
events: v.events,
friends: v.friends,
}
}
}
impl From<&vm::PrivacyForm> for PrivacyForm {
fn from(v: &vm::PrivacyForm) -> Self {
Self { block_mode: v.block_mode, messages: v.messages, pokes: v.pokes }
}
}
impl From<vm::PrivacyForm> for PrivacyForm {
fn from(v: vm::PrivacyForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::PrivacyForm {
type Shown = PrivacyForm;
fn show(&self) -> PrivacyForm {
PrivacyForm::from(self)
}
}
impl From<PrivacyForm> for vm::PrivacyForm {
fn from(v: PrivacyForm) -> Self {
Self { block_mode: v.block_mode, messages: v.messages, pokes: v.pokes }
}
}
impl From<&vm::GatewayItem> for GatewayItem {
fn from(v: &vm::GatewayItem) -> Self {
Self {
session: v.session,
server: SharedString::from(&*v.server),
url: SharedString::from(&*v.url),
status: SharedString::from(&*v.status),
features: strings(&v.features),
admin: v.admin,
}
}
}
impl From<vm::GatewayItem> for GatewayItem {
fn from(v: vm::GatewayItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::GatewayItem {
type Shown = GatewayItem;
fn show(&self) -> GatewayItem {
GatewayItem::from(self)
}
}
impl From<GatewayItem> for vm::GatewayItem {
fn from(v: GatewayItem) -> Self {
Self {
session: v.session,
server: Arc::from(v.server.as_str()),
url: Arc::from(v.url.as_str()),
status: Arc::from(v.status.as_str()),
features: unstrings(&v.features),
admin: v.admin,
}
}
}
impl From<&vm::ConfigItem> for ConfigItem {
fn from(v: &vm::ConfigItem) -> Self {
Self {
key: SharedString::from(&*v.key),
value: SharedString::from(&*v.value),
source: SharedString::from(&*v.source),
description: SharedString::from(&*v.description),
kind: SharedString::from(&*v.kind),
bootstrap: v.bootstrap,
}
}
}
impl From<vm::ConfigItem> for ConfigItem {
fn from(v: vm::ConfigItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::ConfigItem {
type Shown = ConfigItem;
fn show(&self) -> ConfigItem {
ConfigItem::from(self)
}
}
impl From<ConfigItem> for vm::ConfigItem {
fn from(v: ConfigItem) -> Self {
Self {
key: Arc::from(v.key.as_str()),
value: Arc::from(v.value.as_str()),
source: Arc::from(v.source.as_str()),
description: Arc::from(v.description.as_str()),
kind: Arc::from(v.kind.as_str()),
bootstrap: v.bootstrap,
}
}
}
impl From<&vm::PermItem> for PermItem {
fn from(v: &vm::PermItem) -> Self {
Self {
action: SharedString::from(&*v.action),
rule: SharedString::from(&*v.rule),
source: SharedString::from(&*v.source),
everyone: v.everyone,
server_groups: SharedString::from(&*v.server_groups),
channel_groups: SharedString::from(&*v.channel_groups),
}
}
}
impl From<vm::PermItem> for PermItem {
fn from(v: vm::PermItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::PermItem {
type Shown = PermItem;
fn show(&self) -> PermItem {
PermItem::from(self)
}
}
impl From<PermItem> for vm::PermItem {
fn from(v: PermItem) -> Self {
Self {
action: Arc::from(v.action.as_str()),
rule: Arc::from(v.rule.as_str()),
source: Arc::from(v.source.as_str()),
everyone: v.everyone,
server_groups: Arc::from(v.server_groups.as_str()),
channel_groups: Arc::from(v.channel_groups.as_str()),
}
}
}
impl From<&vm::EncoderItem> for EncoderItem {
fn from(v: &vm::EncoderItem) -> Self {
Self {
name: SharedString::from(&*v.name),
api: SharedString::from(&*v.api),
codec: SharedString::from(&*v.codec),
hardware: v.hardware,
ok: v.ok,
status: SharedString::from(&*v.status),
}
}
}
impl From<vm::EncoderItem> for EncoderItem {
fn from(v: vm::EncoderItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::EncoderItem {
type Shown = EncoderItem;
fn show(&self) -> EncoderItem {
EncoderItem::from(self)
}
}
impl From<EncoderItem> for vm::EncoderItem {
fn from(v: EncoderItem) -> Self {
Self {
name: Arc::from(v.name.as_str()),
api: Arc::from(v.api.as_str()),
codec: Arc::from(v.codec.as_str()),
hardware: v.hardware,
ok: v.ok,
status: Arc::from(v.status.as_str()),
}
}
}
impl From<&vm::SettingItem> for SettingItem {
fn from(v: &vm::SettingItem) -> Self {
Self {
key: SharedString::from(&*v.key),
doc: SharedString::from(&*v.doc),
value: SharedString::from(&*v.value),
source: SharedString::from(&*v.source),
}
}
}
impl From<vm::SettingItem> for SettingItem {
fn from(v: vm::SettingItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::SettingItem {
type Shown = SettingItem;
fn show(&self) -> SettingItem {
SettingItem::from(self)
}
}
impl From<SettingItem> for vm::SettingItem {
fn from(v: SettingItem) -> Self {
Self {
key: Arc::from(v.key.as_str()),
doc: Arc::from(v.doc.as_str()),
value: Arc::from(v.value.as_str()),
source: Arc::from(v.source.as_str()),
}
}
}
impl From<&vm::RecordingItem> for RecordingItem {
fn from(v: &vm::RecordingItem) -> Self {
Self {
name: SharedString::from(&*v.name),
detail: SharedString::from(&*v.detail),
clip: v.clip,
path: SharedString::from(&*v.path),
}
}
}
impl From<vm::RecordingItem> for RecordingItem {
fn from(v: vm::RecordingItem) -> Self {
Self::from(&v)
}
}
impl Row for vm::RecordingItem {
type Shown = RecordingItem;
fn show(&self) -> RecordingItem {
RecordingItem::from(self)
}
}
impl From<RecordingItem> for vm::RecordingItem {
fn from(v: RecordingItem) -> Self {
Self {
name: Arc::from(v.name.as_str()),
detail: Arc::from(v.detail.as_str()),
clip: v.clip,
path: Arc::from(v.path.as_str()),
}
}
}
impl From<&vm::AdvancedForm> for AdvancedForm {
fn from(v: &vm::AdvancedForm) -> Self {
Self {
encoder: SharedString::from(&*v.encoder),
hardware: v.hardware,
decoder: SharedString::from(&*v.decoder),
hardware_decoding: v.hardware_decoding,
store_history: v.store_history,
history_page: SharedString::from(&*v.history_page),
dedupe_ms: SharedString::from(&*v.dedupe_ms),
retention_days: SharedString::from(&*v.retention_days),
cache_mb: SharedString::from(&*v.cache_mb),
fetch_images: v.fetch_images,
progress_ms: SharedString::from(&*v.progress_ms),
preview_kb: SharedString::from(&*v.preview_kb),
logs: SharedString::from(&*v.logs),
crash_dir: SharedString::from(&*v.crash_dir),
}
}
}
impl From<vm::AdvancedForm> for AdvancedForm {
fn from(v: vm::AdvancedForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::AdvancedForm {
type Shown = AdvancedForm;
fn show(&self) -> AdvancedForm {
AdvancedForm::from(self)
}
}
impl From<AdvancedForm> for vm::AdvancedForm {
fn from(v: AdvancedForm) -> Self {
Self {
encoder: Arc::from(v.encoder.as_str()),
hardware: v.hardware,
decoder: Arc::from(v.decoder.as_str()),
hardware_decoding: v.hardware_decoding,
store_history: v.store_history,
history_page: Arc::from(v.history_page.as_str()),
dedupe_ms: Arc::from(v.dedupe_ms.as_str()),
retention_days: Arc::from(v.retention_days.as_str()),
cache_mb: Arc::from(v.cache_mb.as_str()),
fetch_images: v.fetch_images,
progress_ms: Arc::from(v.progress_ms.as_str()),
preview_kb: Arc::from(v.preview_kb.as_str()),
logs: Arc::from(v.logs.as_str()),
crash_dir: Arc::from(v.crash_dir.as_str()),
}
}
}
impl From<&vm::AccountForm> for AccountForm {
fn from(v: &vm::AccountForm) -> Self {
Self {
nickname: SharedString::from(&*v.nickname),
identity: SharedString::from(&*v.identity),
uid: SharedString::from(&*v.uid),
uid6: SharedString::from(&*v.uid6),
level: v.level,
server: SharedString::from(&*v.server),
}
}
}
impl From<vm::AccountForm> for AccountForm {
fn from(v: vm::AccountForm) -> Self {
Self::from(&v)
}
}
impl Row for vm::AccountForm {
type Shown = AccountForm;
fn show(&self) -> AccountForm {
AccountForm::from(self)
}
}
impl From<AccountForm> for vm::AccountForm {
fn from(v: AccountForm) -> Self {
Self {
nickname: Arc::from(v.nickname.as_str()),
identity: Arc::from(v.identity.as_str()),
uid: Arc::from(v.uid.as_str()),
uid6: Arc::from(v.uid6.as_str()),
level: v.level,
server: Arc::from(v.server.as_str()),
}
}
}
impl From<&vm::EmojiCell> for EmojiCell {
fn from(v: &vm::EmojiCell) -> Self {
Self {
key: SharedString::from(&*v.key),
name: SharedString::from(&*v.name),
text: SharedString::from(&*v.text),
}
}
}
impl From<vm::EmojiCell> for EmojiCell {
fn from(v: vm::EmojiCell) -> Self {
Self::from(&v)
}
}
impl Row for vm::EmojiCell {
type Shown = EmojiCell;
fn show(&self) -> EmojiCell {
EmojiCell::from(self)
}
}
impl From<EmojiCell> for vm::EmojiCell {
fn from(v: EmojiCell) -> Self {
Self {
key: Arc::from(v.key.as_str()),
name: Arc::from(v.name.as_str()),
text: Arc::from(v.text.as_str()),
}
}
}
impl From<&vm::EmojiRow> for EmojiRow {
fn from(v: &vm::EmojiRow) -> Self {
Self { cells: model(&v.cells) }
}
}
impl From<vm::EmojiRow> for EmojiRow {
fn from(v: vm::EmojiRow) -> Self {
Self::from(&v)
}
}
impl Row for vm::EmojiRow {
type Shown = EmojiRow;
fn show(&self) -> EmojiRow {
EmojiRow::from(self)
}
}
impl From<EmojiRow> for vm::EmojiRow {
fn from(v: EmojiRow) -> Self {
Self { cells: rows(&v.cells) }
}
}
impl From<&studio::StudioScene> for StudioScene {
fn from(v: &studio::StudioScene) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
detail: SharedString::from(&*v.detail),
live: v.live,
kind: SharedString::from(&*v.kind),
}
}
}
impl From<studio::StudioScene> for StudioScene {
fn from(v: studio::StudioScene) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioScene {
type Shown = StudioScene;
fn show(&self) -> StudioScene {
StudioScene::from(self)
}
}
impl From<StudioScene> for studio::StudioScene {
fn from(v: StudioScene) -> Self {
Self {
id: v.id,
name: Arc::from(v.name.as_str()),
detail: Arc::from(v.detail.as_str()),
live: v.live,
kind: Arc::from(v.kind.as_str()),
}
}
}
impl From<&studio::StudioSource> for StudioSource {
fn from(v: &studio::StudioSource) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
kind: SharedString::from(&*v.kind),
visible: v.visible,
locked: v.locked,
background: SharedString::from(&*v.background),
error: SharedString::from(&*v.error),
info: SharedString::from(&*v.info),
front: v.front,
back: v.back,
}
}
}
impl From<studio::StudioSource> for StudioSource {
fn from(v: studio::StudioSource) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioSource {
type Shown = StudioSource;
fn show(&self) -> StudioSource {
StudioSource::from(self)
}
}
impl From<StudioSource> for studio::StudioSource {
fn from(v: StudioSource) -> Self {
Self {
id: v.id,
name: Arc::from(v.name.as_str()),
kind: Arc::from(v.kind.as_str()),
visible: v.visible,
locked: v.locked,
background: Arc::from(v.background.as_str()),
error: Arc::from(v.error.as_str()),
info: Arc::from(v.info.as_str()),
front: v.front,
back: v.back,
}
}
}
impl From<&studio::StudioAudio> for StudioAudio {
fn from(v: &studio::StudioAudio) -> Self {
Self {
name: SharedString::from(&*v.name),
detail: SharedString::from(&*v.detail),
kind: SharedString::from(&*v.kind),
gain_db: v.gain_db,
muted: v.muted,
level: v.level,
error: SharedString::from(&*v.error),
}
}
}
impl From<studio::StudioAudio> for StudioAudio {
fn from(v: studio::StudioAudio) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioAudio {
type Shown = StudioAudio;
fn show(&self) -> StudioAudio {
StudioAudio::from(self)
}
}
impl From<StudioAudio> for studio::StudioAudio {
fn from(v: StudioAudio) -> Self {
Self {
name: Arc::from(v.name.as_str()),
detail: Arc::from(v.detail.as_str()),
kind: Arc::from(v.kind.as_str()),
gain_db: v.gain_db,
muted: v.muted,
level: v.level,
error: Arc::from(v.error.as_str()),
}
}
}
impl From<&studio::StudioLayer> for StudioLayer {
fn from(v: &studio::StudioLayer) -> Self {
Self {
size: SharedString::from(&*v.size),
scale: SharedString::from(&*v.scale),
fps: SharedString::from(&*v.fps),
bitrate: SharedString::from(&*v.bitrate),
min_bitrate: SharedString::from(&*v.min_bitrate),
}
}
}
impl From<studio::StudioLayer> for StudioLayer {
fn from(v: studio::StudioLayer) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioLayer {
type Shown = StudioLayer;
fn show(&self) -> StudioLayer {
StudioLayer::from(self)
}
}
impl From<StudioLayer> for studio::StudioLayer {
fn from(v: StudioLayer) -> Self {
Self {
size: Arc::from(v.size.as_str()),
scale: Arc::from(v.scale.as_str()),
fps: Arc::from(v.fps.as_str()),
bitrate: Arc::from(v.bitrate.as_str()),
min_bitrate: Arc::from(v.min_bitrate.as_str()),
}
}
}
impl From<&studio::StudioViewer> for StudioViewer {
fn from(v: &studio::StudioViewer) -> Self {
Self {
client: v.client,
name: SharedString::from(&*v.name),
state: SharedString::from(&*v.state),
}
}
}
impl From<studio::StudioViewer> for StudioViewer {
fn from(v: studio::StudioViewer) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioViewer {
type Shown = StudioViewer;
fn show(&self) -> StudioViewer {
StudioViewer::from(self)
}
}
impl From<StudioViewer> for studio::StudioViewer {
fn from(v: StudioViewer) -> Self {
Self {
client: v.client,
name: Arc::from(v.name.as_str()),
state: Arc::from(v.state.as_str()),
}
}
}
impl From<&studio::StudioPick> for StudioPick {
fn from(v: &studio::StudioPick) -> Self {
Self {
name: SharedString::from(&*v.name),
detail: SharedString::from(&*v.detail),
kind: SharedString::from(&*v.kind),
icon: image(&v.icon),
selected: v.selected,
}
}
}
impl From<studio::StudioPick> for StudioPick {
fn from(v: studio::StudioPick) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioPick {
type Shown = StudioPick;
fn show(&self) -> StudioPick {
StudioPick::from(self)
}
}
impl From<&studio::StudioStatus> for StudioStatus {
fn from(v: &studio::StudioStatus) -> Self {
Self {
running: v.running,
destination: SharedString::from(&*v.destination),
quality: v.quality,
quality_text: SharedString::from(&*v.quality_text),
format: SharedString::from(&*v.format),
details: SharedString::from(&*v.details),
live: v.live,
starting: v.starting,
elapsed: SharedString::from(&*v.elapsed),
viewers: v.viewers,
participants: v.participants,
can_go_live: v.can_go_live,
hint: SharedString::from(&*v.hint),
recording: v.recording,
recorded: SharedString::from(&*v.recorded),
replay_seconds: v.replay_seconds,
replay_held: SharedString::from(&*v.replay_held),
output_width: v.output_width,
output_height: v.output_height,
fps: v.fps,
detached: v.detached,
can_detach: v.can_detach,
screen_shown: v.screen_shown,
camera_shown: v.camera_shown,
window_shown: v.window_shown,
}
}
}
impl From<studio::StudioStatus> for StudioStatus {
fn from(v: studio::StudioStatus) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioStatus {
type Shown = StudioStatus;
fn show(&self) -> StudioStatus {
StudioStatus::from(self)
}
}
impl From<StudioStatus> for studio::StudioStatus {
fn from(v: StudioStatus) -> Self {
Self {
running: v.running,
destination: Arc::from(v.destination.as_str()),
quality: v.quality,
quality_text: Arc::from(v.quality_text.as_str()),
format: Arc::from(v.format.as_str()),
details: Arc::from(v.details.as_str()),
live: v.live,
starting: v.starting,
elapsed: Arc::from(v.elapsed.as_str()),
viewers: v.viewers,
participants: v.participants,
can_go_live: v.can_go_live,
hint: Arc::from(v.hint.as_str()),
recording: v.recording,
recorded: Arc::from(v.recorded.as_str()),
replay_seconds: v.replay_seconds,
replay_held: Arc::from(v.replay_held.as_str()),
output_width: v.output_width,
output_height: v.output_height,
fps: v.fps,
detached: v.detached,
can_detach: v.can_detach,
screen_shown: v.screen_shown,
camera_shown: v.camera_shown,
window_shown: v.window_shown,
}
}
}
impl From<&studio::StudioForm> for StudioForm {
fn from(v: &studio::StudioForm) -> Self {
Self {
destination: v.destination,
title: SharedString::from(&*v.title),
game: SharedString::from(&*v.game),
message: SharedString::from(&*v.message),
show_viewers: v.show_viewers,
show_chat: v.show_chat,
show_now_playing: v.show_now_playing,
audio: v.audio,
bitrate: SharedString::from(&*v.bitrate),
}
}
}
impl From<studio::StudioForm> for StudioForm {
fn from(v: studio::StudioForm) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioForm {
type Shown = StudioForm;
fn show(&self) -> StudioForm {
StudioForm::from(self)
}
}
impl From<StudioForm> for studio::StudioForm {
fn from(v: StudioForm) -> Self {
Self {
destination: v.destination,
title: Arc::from(v.title.as_str()),
game: Arc::from(v.game.as_str()),
message: Arc::from(v.message.as_str()),
show_viewers: v.show_viewers,
show_chat: v.show_chat,
show_now_playing: v.show_now_playing,
audio: v.audio,
bitrate: Arc::from(v.bitrate.as_str()),
}
}
}
impl From<&studio::StudioSourceForm> for StudioSourceForm {
fn from(v: &studio::StudioSourceForm) -> Self {
Self {
id: v.id,
name: SharedString::from(&*v.name),
kind: SharedString::from(&*v.kind),
x: SharedString::from(&*v.x),
y: SharedString::from(&*v.y),
width: SharedString::from(&*v.width),
height: SharedString::from(&*v.height),
scale: SharedString::from(&*v.scale),
fit: SharedString::from(&*v.fit),
crop_left: SharedString::from(&*v.crop_left),
crop_top: SharedString::from(&*v.crop_top),
crop_right: SharedString::from(&*v.crop_right),
crop_bottom: SharedString::from(&*v.crop_bottom),
opacity: v.opacity,
locked: v.locked,
visible: v.visible,
background: SharedString::from(&*v.background),
blur: SharedString::from(&*v.blur),
background_path: SharedString::from(&*v.background_path),
background_colour: SharedString::from(&*v.background_colour),
text: SharedString::from(&*v.text),
text_size: SharedString::from(&*v.text_size),
colour: SharedString::from(&*v.colour),
path: SharedString::from(&*v.path),
mirror: v.mirror,
}
}
}
impl From<studio::StudioSourceForm> for StudioSourceForm {
fn from(v: studio::StudioSourceForm) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioSourceForm {
type Shown = StudioSourceForm;
fn show(&self) -> StudioSourceForm {
StudioSourceForm::from(self)
}
}
impl From<StudioSourceForm> for studio::StudioSourceForm {
fn from(v: StudioSourceForm) -> Self {
Self {
id: v.id,
name: Arc::from(v.name.as_str()),
kind: Arc::from(v.kind.as_str()),
x: Arc::from(v.x.as_str()),
y: Arc::from(v.y.as_str()),
width: Arc::from(v.width.as_str()),
height: Arc::from(v.height.as_str()),
scale: Arc::from(v.scale.as_str()),
fit: Arc::from(v.fit.as_str()),
crop_left: Arc::from(v.crop_left.as_str()),
crop_top: Arc::from(v.crop_top.as_str()),
crop_right: Arc::from(v.crop_right.as_str()),
crop_bottom: Arc::from(v.crop_bottom.as_str()),
opacity: v.opacity,
locked: v.locked,
visible: v.visible,
background: Arc::from(v.background.as_str()),
blur: Arc::from(v.blur.as_str()),
background_path: Arc::from(v.background_path.as_str()),
background_colour: Arc::from(v.background_colour.as_str()),
text: Arc::from(v.text.as_str()),
text_size: Arc::from(v.text_size.as_str()),
colour: Arc::from(v.colour.as_str()),
path: Arc::from(v.path.as_str()),
mirror: v.mirror,
}
}
}
impl From<&studio::StudioSettingsForm> for StudioSettingsForm {
fn from(v: &studio::StudioSettingsForm) -> Self {
Self {
replay_seconds: SharedString::from(&*v.replay_seconds),
replay_memory: SharedString::from(&*v.replay_memory),
recording_dir: SharedString::from(&*v.recording_dir),
preview_width: SharedString::from(&*v.preview_width),
preview_fps: SharedString::from(&*v.preview_fps),
}
}
}
impl From<studio::StudioSettingsForm> for StudioSettingsForm {
fn from(v: studio::StudioSettingsForm) -> Self {
Self::from(&v)
}
}
impl Row for studio::StudioSettingsForm {
type Shown = StudioSettingsForm;
fn show(&self) -> StudioSettingsForm {
StudioSettingsForm::from(self)
}
}
impl From<StudioSettingsForm> for studio::StudioSettingsForm {
fn from(v: StudioSettingsForm) -> Self {
Self {
replay_seconds: Arc::from(v.replay_seconds.as_str()),
replay_memory: Arc::from(v.replay_memory.as_str()),
recording_dir: Arc::from(v.recording_dir.as_str()),
preview_width: Arc::from(v.preview_width.as_str()),
preview_fps: Arc::from(v.preview_fps.as_str()),
}
}
}