You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When transferring an old project from FRB V1 to FRB V2, I accidentally found that param type std::sync::MutexGuard<> is not supported. For example:
// my real examplepub(crate)fnget_unside_piece_by_pos(board_array:&std::sync::MutexGuard<[u8;256]>,board_pos:u8,) -> PieceType{
...}// the same issued examplepubfntest_mutex_guard(board_array:&std::sync::MutexGuard<u8>){println!("{}", board_array);}
The generation is finished with no error, but the output frb_generated.rs has the below error:
along with 2 errors within frb_generated.io.rs related to code:
Here, I said I found it accidentally, which means that the fn get_unside_piece_by_pos is not planned to be exposed. It is used in another module. And it is used in an exposed API like this:
pub(crate)staticBOARD_ARRAY:Lazy<Mutex<[u8;256]>> = Lazy::new(|| Mutex::new([0;256]));
...pubfnis_legal_move(src_row:u8,src_col:u8,dst_row:u8,dst_col:u8) -> bool{let src_pos = crate::chess::get_board_pos_from_row_col(src_row, src_col);let dst_pos = crate::chess::get_board_pos_from_row_col(dst_row, dst_col);// get src piece|let board_array = BOARD_ARRAY.lock().unwrap();let unside_src_piece = crate::chess::get_unside_piece_by_pos(&board_array, src_pos);// here it used !
...}
So practically, I can ignore it.
But now I wonder whether the type std::sync::MutexGuard<...> is useful for an API fn in some (corner) cases?
If this kind of type is really useful, then hopefully, it could be supported in the future.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Issue
When transferring an old project from FRB V1 to FRB V2, I accidentally found that param type
std::sync::MutexGuard<>
is not supported. For example:The generation is finished with no error, but the output
frb_generated.rs
has the below error:along with 2 errors within
frb_generated.io.rs
related to code:Should be supported?
Here, I said I found it accidentally, which means that the fn
get_unside_piece_by_pos
is not planned to be exposed. It is used in another module. And it is used in an exposed API like this:So practically, I can ignore it.
But now I wonder whether the type
std::sync::MutexGuard<...>
is useful for an API fn in some (corner) cases?If this kind of type is really useful, then hopefully, it could be supported in the future.
The text was updated successfully, but these errors were encountered: