Created
January 10, 2018 13:39
-
-
Save krishnakumar4a4/90b8324dc6a4d39e5abf1eb5d52e2c47 to your computer and use it in GitHub Desktop.
can't leak private type error and how i fixed it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn insert_details(handle: Connection, details: &Details) -> Vec<Result<i32>>{ | |
let dris = details.detail_record_ids; | |
//Check if the corresponding detailrecord entries are present in DetailRecord table | |
dris.iter().map(|detail_record| { | |
//Break and err if one of the insert fails | |
handle.execute("INSERT INTO Details (detail_record_ids) VALUES (?1)",&[&detail_record.id]) | |
}).collect() | |
} | |
//Following error | |
error[E0446]: private type `Details<'_>` in public interface | |
--> src/main.rs:155:1 | |
| | |
155 | / pub fn insert_details(handle: Connection, details: &Details) -> Vec<Result<i32>>{ | |
156 | | let dris = details.detail_record_ids; | |
157 | | //Check if the corresponding detailrecord entries are present in DetailRecord table | |
158 | | dris.iter().map(|detail_record| { | |
... | | |
161 | | }).collect() | |
162 | | } | |
| |_^ can't leak private type | |
//Error fixed by removing pub key word for the function. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment