Implement the Rtn struct in Rust to manage and analyze financial return data based on the provided test code. The struct should allow for the following functionalities:
Constructor (new):
The constructor should create a new Rtn instance from a vector of dates, market values (MVs), and profit/loss values (PLs).
Ensure that the input vectors dates, mvs, and pls have the same length. Return an error if they do not.
Reject any input with duplicate dates and return an error message.
Extend dates to include all dates from the minimum to the maximum date, filling in missing dates with corresponding market values and setting profit/loss values to zero for those missing dates.
Indexing Dates:
Implement a method to find the index of a specific date within the dates vector.
Time-Weighted Rate of Return (TWRR):
Implement the method twrr_dr to calculate the daily returns (DR) for a specified range of dates.
Implement the method twrr_cr to calculate the cumulative returns (CR) for a specified range of dates.
Dietz Method:
Implement the dietz_avc method to compute the average contribution to value at a specified date range.
Implement the dietz method to calculate the Dietz return over a specified range of dates, handling cases where values may be None appropriately.
Cumulative Profit/Loss Calculation:
Implement the method cum_pl to compute cumulative profit/loss for the specified date range.
Error Handling:
Return appropriate error messages for invalid date ranges and ensure that the functions handle edge cases where dates are out of range or cannot be calculated.
The implementation must reside in the /app/ directory and should adhere to the functionality outlined by the test cases, ensuring that they pass successfully after the implementation is complete.