diff --git a/source/highlight/index.html b/source/highlight/index.html index 150b774a..40880fda 100644 --- a/source/highlight/index.html +++ b/source/highlight/index.html @@ -178,29 +178,33 @@ } } -const CODE = `class Person - include ActiveModel::Conversion - include ActiveModel::Validations - - validates_presence_of :name +const CODE = `struct Person { + name: String, + age: u32, +} - attr_accessor :name +impl Person { + fn new(name: String, age: u32) -> Person { + Person { name, age } + } - def initialize(attributes = {}) - @name = attributes[:name] - end + fn show(&self) { + println!("Name: {}, Age: {}", self.name, self.age); + } - def persist - @persisted = true - end + fn set_name(&mut self, new_name: String) { + self.name = new_name; + } - def persisted? - @persisted - end -end + fn set_age(&mut self, new_age: u32) { + self.age = new_age; + } +} -person1 = Person.new(:name => "matz") -p person1.valid?`; +fn main() { + let mut person = Person::new("Alice".to_string(), 30); + person.show(); +}`; class Controller { constructor() { @@ -215,7 +219,7 @@ this.value = { engine: localStorage.getItem('engine') || 'highlight', theme: localStorage.getItem('theme') || 'tomorrow', - language: localStorage.getItem('language') || 'ruby', + language: localStorage.getItem('language') || 'rust', code: localStorage.getItem('code') || CODE }; this.onchange = {