*/ } // Questions: // // * Can trace_name retain an alias to the Trace*? // * Can trace_name mutate the Trace*? // * Can a caller mutate the Trace* during trace_name? // * Who is responsible to freeing the char*?
/* impl */ } // Questions: // // * Can trace_name retain an alias to the Trace? No. // * Can trace_name mutate the Trace? No. // * Can a caller mutate the Trace during trace_name? No. // * Who is responsible to freeing the String? The caller.
-‐> String { /* impl */ } // Questions: // // * Can trace_name retain an alias to the Trace? No. // * Can trace_name mutate the Trace? No. // * Can a caller mutate the Trace during trace_name? No. // * Who is responsible to freeing the String? The caller. // * TLDR: The same story!
/** line_len takes two Point structs. You can rely on the fact that it will not create aliases to the Points that outlive the invocation. Point should be memory that is valid and immutable for the duration of the call to the line_len function. */ f64 line_len(const Point p1, const Point p2);
line_len takes two Point structs. You can rely on the fact that it will not create aliases to the Points that outlive the invocation. Point should be memory that is valid and immutable for the duration of the call to the line_len function. */ f64 line_len(const Point p1, const Point p2); #[no_mangle] extern "C" fn line_len(p1: &Point, p2: &Point) -‐> f64 { /* impl */ }
line_len takes two Point structs. You can rely on the fact that it will not create aliases to the Points that outlive the invocation. Point should be memory that is valid and immutable for the duration of the call to the line_len function. */ f64 line_len(const Point p1, const Point p2); #[no_mangle] extern "C" fn line_len(p1: &Point, p2: &Point) -‐> f64 { /* impl */ }
line_len takes two Point structs. You can rely on the fact that it will not create aliases to the Points that outlive the invocation. Point should be memory that is valid and immutable for the duration of the call to the line_len function. */ f64 line_len(const Point p1, const Point p2); #[no_mangle] extern "C" fn line_len(p1: &Point, p2: &Point) -‐> f64 { /* impl */ }
line_len takes two Point structs. You can rely on the fact that it will not create aliases to the Points that outlive the invocation. Point should be memory that is valid and immutable for the duration of the call to the line_len function. */ f64 line_len(const Point p1, const Point p2); #[no_mangle] extern "C" fn line_len(p1: &Point, p2: &Point) -‐> f64 { /* impl */ }