The max amount of rested you can get is equal to the amount of xp you need for that level.
E.G. You need 200,000 xp for the level, you will get 200,000 rested.
However, if you are at 199,999 / 200,000 xp you will still get 200,000 rested. If you then ding your rested xp bar will be shorter than the xp bar - a lighter colour - this will allow you to accumulate more rested xp, up to the max for that level.
I hope that makes sense lol.