Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Help me understand this compiler error
I am getting a compiler error that I completely don't understand. I literally copied the piece of example code from the documentation, and made some simple changes, but the compiler does not like it and is giving me an error that I just don't understand, what it seems to what makes no sense and when I give in and put what it is looking for it just generates a different error.
Here is the code fragment:
pub struct ChartDisplay<Inst: std::marker::Copy + 'static> {
lheight: f64,
topofcabs: f64,
cabheight: f64,
bottomofcabs: f64,
numberofcabs: usize,
cabarray: HashMap<String,f64>,
topofchart: f64,
chartheight: f64,
bottomofchart: f64,
totallength: f64,
chartstationoffset: f64,
topofstorage: f64,
storagetrackheight: f64,
bottomofstorage: f64,
numberofstoragetracks: usize,
storageoffset: f64,
stationarray: HashMap<String,f64>,
storagearray: HashMap<String,f64>,
timescale: u32,
timeinterval: u32,
labelsize: u32,
hull: TkCanvas<Inst>,
}
impl<TkCanvas<Inst>> Deref for ChartDisplay<Inst> {
type Target = TkCanvas<Inst>;
fn deref(&self) -> &Self::Target {
&self.hull
}
}
and here is the error message:
Compiling time_table_gui v0.1.0 (/home/heller/RustProjects/time_table_gui)
error: expected `::`, found `Deref`
--> src/ttmainwindow.rs:76:22
|
76 | impl<TkCanvas<Inst>> Deref for ChartDisplay<Inst> {
| ^^^^^ expected `::`
error: could not compile `time_table_gui` (bin "time_table_gui") due to 1 previous error
3 posts - 2 participants
🏷️ Rust_feed