Struct userstyles::response::Style
[−]
[src]
pub struct Style { pub id: i32, pub name: String, pub description: String, pub user: User, pub updated: String, pub weekly_install_count: i32, pub total_install_count: i32, pub rating: Option<f32>, pub after_screenshot_name: Option<String>, pub obsoleting_style_id: Option<i32>, pub obsoleting_style_name: Option<String>, pub obsolete: u8, pub admin_delete_reason: Option<String>, pub obsoletion_message: Option<String>, pub screenshots: Option<Vec<String>>, pub license: Option<String>, pub created: String, pub category: String, pub subcategory: Option<String>, pub pledgie_id: Option<i32>, pub additional_info: Option<String>, pub css: String, pub discussions: Vec<Discussion>, pub userjs_url: Option<String>, pub style_settings: Vec<StyleSetting>, }
This struct is the root of the standard userstyles API response.
The request url is https://userstyles.org/api/v1/styles/{id}
.
Fields
id: i32
id of the style, this is part of the userstyles.org
url
name: String
Name of the style
description: String
Summary of what the style does
user: User
User that created the style
updated: String
Last update time
weekly_install_count: i32
Installs per this week
total_install_count: i32
Total install count
rating: Option<f32>
Rating of this style from 1 to 3
after_screenshot_name: Option<String>
File name of the thumbnail
obsoleting_style_id: Option<i32>
id for newer version of this style
obsoleting_style_name: Option<String>
Name of the replacing style
obsolete: u8
Indicate that style has been discontinued
admin_delete_reason: Option<String>
Reason why style has been removed by an admin
obsoletion_message: Option<String>
Reason why style has been obsoleted
screenshots: Option<Vec<String>>
Screenshot fil names for this style
license: Option<String>
License the style is published under
created: String
Creation time
category: String
Category this style falls in
subcategory: Option<String>
Subcategory or domain name
pledgie_id: Option<i32>
Pleadgie id, mostly unused
additional_info: Option<String>
Additional informations about this style
css: String
The style's css with template placeholders
discussions: Vec<Discussion>
Comments on this style
userjs_url: Option<String>
JavaScipt file name for this style
style_settings: Vec<StyleSetting>
Available settings
Methods
impl Style
[src]
fn get_css(&self, settings: Option<HashMap<String, String>>) -> String
Get the CSS of a style. This uses the style's default settings unless
settings
exists and provides an override. The elements of settings
are always prioritized over the defaults.
This automatically prepends ik-
to every key in settings
.
So ACCENTCOLOR
will be ik-ACCENTCOLOR
.
This is required for correctly replacing templates.
Examples
use std::collections::HashMap; use userstyles::response::Style; let style = Style::default(); let mut map = HashMap::new(); map.insert(String::from("ACCENTCOLOR"), String::from("#f00ba2")); let css = style.get_css(Some(map));
Trait Implementations
impl PartialEq for Style
[src]
fn eq(&self, __arg_0: &Style) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Style) -> bool
This method tests for !=
.