{"action":"closed","issue":{"url":"https://api.github.com/repos/serde-rs/serde/issues/633","repository_url":"https://api.github.com/repos/serde-rs/serde","labels_url":"https://api.github.com/repos/serde-rs/serde/issues/633/labels{/name}","comments_url":"https://api.github.com/repos/serde-rs/serde/issues/633/comments","events_url":"https://api.github.com/repos/serde-rs/serde/issues/633/events","html_url":"https://github.com/serde-rs/serde/issues/633","id":192280792,"number":633,"title":"Serialization with a Visitor","user":{"login":"lukas-123","id":11629114,"avatar_url":"https://avatars.githubusercontent.com/u/11629114?v=3","gravatar_id":"","url":"https://api.github.com/users/lukas-123","html_url":"https://github.com/lukas-123","followers_url":"https://api.github.com/users/lukas-123/followers","following_url":"https://api.github.com/users/lukas-123/following{/other_user}","gists_url":"https://api.github.com/users/lukas-123/gists{/gist_id}","starred_url":"https://api.github.com/users/lukas-123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukas-123/subscriptions","organizations_url":"https://api.github.com/users/lukas-123/orgs","repos_url":"https://api.github.com/users/lukas-123/repos","events_url":"https://api.github.com/users/lukas-123/events{/privacy}","received_events_url":"https://api.github.com/users/lukas-123/received_events","type":"User","site_admin":false},"labels":[{"id":376137667,"url":"https://api.github.com/repos/serde-rs/serde/labels/support","name":"support","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-29T13:24:30Z","updated_at":"2016-12-03T19:39:15Z","closed_at":"2016-12-03T19:39:15Z","body":"I am a rust newb and I have a question about custom serialization.\r\nI have the following struct:\r\n```rust\r\n#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]\r\npub struct StatusBlock {\r\n    pub full_text: String,\r\n    pub short_text: Option<String>,\r\n    pub color: Option<String>,\r\n    pub background: Option<String>,\r\n    pub border: Option<String>,\r\n    pub min_width: Option<Width>,\r\n    pub align: Option<Align>,\r\n    pub name: Option<String>,\r\n    pub instance: Option<String>,\r\n    #[serde(default = \"StatusBlock::default_is_urgent\")]\r\n    pub urgent: bool,\r\n    #[serde(default = \"StatusBlock::default_has_seperator\")]\r\n    pub seperator: bool,\r\n    pub seperator_block_width: Option<u32>,\r\n    #[serde(default = \"StatusBlock::default_markup\")]\r\n    pub markup: Markup,\r\n}\r\n```\r\n\r\nI now have a struct ```struct StatusBlocks(Vec<StatusBlock>)``` which I want to serialize to html as a string. I would like the user to be able to supply a visitor for ```StatusBlock``` so that he can generate an html string based on the information that the struct contains. How would I do that with serde?"}}
{"actor":{"display_login":"dtolnay"}}