Guest User

Untitled

a guest
Sep 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. impl ElementUpdate for Circle {
  2. fn set_group_transform(&mut self, transform: &Transform) {
  3. self.transform_data.group_transform = transform.clone();
  4. }
  5.  
  6. fn set_local_transform(&mut self, transform: &Transform) {
  7. self.transform_data.local_transform = transform.clone();
  8. }
  9.  
  10. fn set_color(&mut self, color: &Color) {
  11. self.vertex_data.color = color.clone();
  12. }
  13. }
  14.  
  15. pub fn update_node<T: Element + ElementUpdate>(element: &mut T, attribute_stack: &AttributeStack) {
  16. element.set_group_transform(&attribute_stack.transform);
  17. }
  18.  
  19. /*
  20. error[E0277]: the trait bound `&element::circle::Circle: element::ElementUpdate` is not satisfied
  21. --> src\processor.rs:12:40
  22. |
  23. 12 | ElementType::Circle(circle) => update_node(&mut circle, &attribute_stack),
  24. | ^^^^^^^^^^^ the trait `element::ElementUpdate` is not implemented for `&element::circle::Circle`
  25. |
  26. = help: the following implementations were found:
  27. <element::circle::Circle as element::ElementUpdate>
  28. note: required by `processor::update_node`
  29. --> src\processor.rs:26:1
  30. |
  31. 26 | pub fn update_node<T: ElementUpdate>(element: &mut T, attribute_stack: &AttributeStack) {
  32. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  33. */
Add Comment
Please, Sign In to add comment