Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•error•E0277•the size for values of type `str` cannot be known at compilation time

//Resolve *ptr = ptr.to_uppercase();
fn modifier2(mut ptr: Box<String>) -> Box<String> {  
  println!("Ptr points to {:p}, and value is {}", ptr, *ptr);
  **ptr = ptr.to_uppercase(); //Error
  }
  fn modifier3(ptr: &mut Box<String>) { 
  **ptr = ptr.to_uppercase(); // No error now
}
 
PREVIOUS NEXT
Tagged: #size #values #type #compilation #time
ADD COMMENT
Topic
Name
9+6 =